c# - 将多个文本框和标签放在同一列CSS上?

标签 c# asp.net css layout

enter image description here

你好! 是否可以通过 CSS 编码将多个文本框和标签放在同一列上,如图所示?以及如何?

当我这样做时,它看起来像这样: enter image description here 谢谢

最佳答案

试试这个

在您的 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/

相关文章:

javascript - 启用/禁用 <asp :Panel> and all its control using Javascript

html - 即使禁用 View 状态和控件状态,该值仍保留在 asp.net webform 页面中

asp.net - 将 ASP.net Core 2.0 部署到 Azure

html - 如何在图像上叠加 Glyphicon

html - 使用 Sprite 进行水平导航

c# - Odata 使用 Knockout Js 路由和访问它

c# - MVVM 绑定(bind)到 Entity Framework 中的外键属性

c# - 将密码存储到sql中的最佳方法

c# - 如何从数据库中获取最接近的日期时间?

html - 跨浏览器 - CSS 填充问题