我有一个ASP.NET控件.我想将文本框与右侧对齐,并将标签对齐到左侧.
到目前为止我有这个代码:
<td colspan="2">
<asp:Label ID="Label6" runat="server" Text="Label"></asp:Label>
<div style="text-align: right">
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</div>
</td>
Run Code Online (Sandbox Code Playgroud)
文本框与右侧对齐,但标签与左侧和上方的线对齐.如何解决这个问题,使标签位于左侧,文本框位于右侧,两者位于同一条线上?
谢谢
sat*_*ish 11
你可以使用风格
<td colspan="2">
<div style="float:left; width:80px"><asp:Label ID="Label6" runat="server" Text="Label"></asp:Label></div>
<div style="float: right; width:100px">
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</div>
<div style="clear:both"></div>
</td>
Run Code Online (Sandbox Code Playgroud)