如图,这里有四个控件,两个Label,一个DropDownList和一个TextBox。TextBox被我拉大后左边的label控件直接跑到TextBox的最底部去了,我想让它对齐在TextBox的第一行应该怎么实现?
你好,
可以对业务说明这个单元格添加css vertical-align: text-top。 我在这里使用table。
<table>
<tr>
<td><asp:Label ID="Label1" runat="server" Text="业务选择"></asp:Label></td>
<td><asp:DropDownList ID="DropDownList2" runat="server"></asp:DropDownList></td>
</tr>
<tr>
<td style="vertical-align: text-top;"><asp:Label ID="Label2" runat="server" Text="业务说明"></asp:Label></td>
<td><asp:TextBox ID="TextBox2" runat="server" TextMode="MultiLine" Height="100px"></asp:TextBox></td>
</tr>
</table>
结果:
label控件和TextBox分别放在两个div里