我似乎在将文本框控件右对齐时遇到问题。我想要它,所以名字,中间名和&姓氏在左侧,但文本框控件位于Div类边框col-sm-4的右侧(屏幕的33.33%)
<div class="container">
<div class="border row">
<div class="border col-sm-4"> First Name: <asp:TextBox ID="First_NameTextBox" runat="server" Text='<%# Bind("First_Name") %>' />
</div>
<div class="border col-sm-4"> Middle Name: <asp:TextBox ID="Middle_NameTextBox" runat="server" Text='<%# Bind("Middle_Name") %>' />
</div>
<div class="border col-sm-4"> Last Name: <asp:TextBox ID="Last_NameTextBox" runat="server" Text='<%# Bind("Last_Name") %>' />
</div>
</div>
.container {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
对此的任何帮助都会很棒。
答案 0 :(得分:0)
检查以下更改
label
或span
并添加CSS以向左浮动clear:both
添加到您的CSS课程border
.container span {
float: left;
}
.container input[type="text"] {
float: right
}
.border {
clear: both;
}
&#13;
<div class="container">
<div class="border row">
<div class="border col-sm-4"><span>First Name:</span>
<asp:TextBox ID="First_NameTextBox" runat="server" Text='<%# Bind("First_Name") %>' />
</div>
<div class="border col-sm-4"><span>Middle Name:</span>
<asp:TextBox ID="Middle_NameTextBox" runat="server" Text='<%# Bind("Middle_Name") %>' />
</div>
<div class="border col-sm-4"><span>Last Name:</span>
<asp:TextBox ID="Last_NameTextBox" runat="server" Text='<%# Bind("Last_Name") %>' />
</div>
</div>
&#13;