我正在使用bootstrap3在visual studio asp.net中创建此作业。无法让文本框位于右侧。另外,我无法更改提交按钮的颜色。我是否需要在文本框中执行某些操作并在css中提交按钮?
这应该是它的样子: 这就是我所拥有的: 我所有三个文本框的代码:
rowID%4 === 3
我的提交按钮代码:
<div class="panel panel-default">
<div class="panel-heading">Napkins (pk of 30) - <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label></div>
<div class="panel-body"><img src="Images/napkin.jpg" /><span>Quantity:</span>
<asp:TextBox ID="txtbox2" runat="server" CssClass="form-control" Width="50px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Quantity Required" ControlToValidate="txtbox2" Display="Dynamic" ForeColor="Red"></asp:RequiredFieldValidator>
<asp:RangeValidator ID="RangeValidator2" runat="server" ErrorMessage="Enter a value 1-100" ControlToValidate="txtbox2" Display="Dynamic" MaximumValue="100" MinimumValue="1" Type="Double" ForeColor="Red"></asp:RangeValidator>
</div>
</div>
答案 0 :(得分:0)
例如,您可以使用bootstrap列大小。 CSS:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
代码:
<div class="panel panel-default">
<div class="panel-heading">
Napkins (pk of 30) - <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label></div>
<div class="panel-body row">
<img class="col-sm-4" src="Images/napkin.jpg" />
<span class="col-sm-3">Quantity:</span>
<asp:TextBox ID="txtbox2" runat="server" CssClass="col-sm-5" Width="50px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Quantity Required" ControlToValidate="txtbox2" Display="Dynamic" ForeColor="Red"></asp:RequiredFieldValidator>
<asp:RangeValidator ID="RangeValidator2" runat="server" ErrorMessage="Enter a value 1-100" ControlToValidate="txtbox2" Display="Dynamic" MaximumValue="100" MinimumValue="1" Type="Double" ForeColor="Red"></asp:RangeValidator>
</div>
对于按钮中的颜色,您也可以从bootstrap添加css类,例如:btn-success
<asp:Button ID="btnSubmit" runat="server" Text="Submit Order" CssClass="btn-success" Height="37px" Width="110px" />