你好! 是否可以通过 CSS 编码将多个文本框和标签放在同一列上,如图所示?以及如何?
当我这样做时,它看起来像这样: 谢谢
最佳答案
试试这个
在您的 aspx 页面中
<form id="form1" runat="server">
<div class="row">
<asp:Label ID="Label1" runat="server" Text="Label" CssClass="label">Dropdown:</asp:Label>
<asp:DropDownList ID="DropDownList1" runat="server" CssClass="input"></asp:DropDownList>
</div>
<div class="row">
<asp:Label ID="Label2" runat="server" Text="Label" CssClass="label">Textbox 1:</asp:Label>
<asp:TextBox ID="TextBox1" runat="server" CssClass="input"></asp:TextBox>
</div>
<div class="row">
<asp:Label ID="Label3" runat="server" Text="Label" CssClass="label">Textbox 2:</asp:Label>
<asp:TextBox ID="TextBox2" runat="server" CssClass="input"></asp:TextBox>
</div>
</form>
在你的CSS文件中
.row{ display:block; height:30px;}
.label{ float:left; width:100px;}
.input{ float:left; width:100px;}
关于c# - 将多个文本框和标签放在同一列CSS上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8325791/