【问题标题】:Radio buttons with bootstrap in ASP.NetASP.Net 中带引导程序的单选按钮
【发布时间】:2013-08-21 15:20:44
【问题描述】:
我使用 Visual Studio 2012 和从 nuget 包下载的引导程序。
我有下面的代码来显示单选按钮
<asp:Label ID="Label6" runat="server" Text="Label"></asp:Label>
<asp:RadioButtonList ID="RadioButtonList3" runat="server" CssClass="radio">
<asp:ListItem Text="Yes" Value="yes"></asp:ListItem>
<asp:ListItem Text="No" Value="no"></asp:ListItem>
</asp:RadioButtonList>
现在对齐不正确,就像
如何使用 bootstrap 和 asp.net 正确对齐,如下所示
【问题讨论】:
标签:
asp.net
.net
twitter-bootstrap
webforms
bootstrapper
【解决方案1】:
我实际上找到了另一种方法,并且使用 bootstrap 的 row-fluid 属性可以正常工作
<div class="row-fluid">
<div class="span6 offset3">
fluid6
<div class="row-fluid">
<div class="span6">
<asp:Label ID="Label6" runat="server" Text="Label"></asp:Label>
</div>
<div class="span6 radio">
<asp:RadioButtonList ID="RadioButtonList3" runat="server">
<asp:ListItem Text="Yes" Value="yes"></asp:ListItem>
<asp:ListItem Text="No" Value="no"></asp:ListItem>
</asp:RadioButtonList>
</div>
</div>
</div>
</div>
【解决方案2】:
您将需要使用一点 CSS。
尝试将标签设置为:
#RadioButtonList3 label{
display: inline-block;
width: 200px; <---- wild shot in the dark on the exact width
text-align: center;
}