【发布时间】:2019-06-01 14:28:50
【问题描述】:
我是 MVC Razor 的新手,需要更改单选按钮列表的显示方式。目前所有选项都在一起(它们之间没有空格),但我需要将它们显示为看起来像按钮。如何“分离”它们以使其看起来像按钮并像单选按钮列表一样工作?
这是它目前的样子:
这就是我需要它们的样子:
我需要为整个项目的所有单选按钮应用这种样式。以下是它们的创建方式:
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div data-toggle="buttons" class="btn-group">
<label class="btn btn-radio">
@Html.RadioButtonFor(m => m.Address.RiskIsResidence, "Yes", new { name = "radIsResidence" }) Yes
</label>
<label class="btn btn-radio">
@Html.RadioButtonFor(m => m.Address.RiskIsResidence, "No", new { name = "radIsResidence" }) No
</label>
</div>
</div>
CSS:
.btn-radio {
/*border-radius: 30px;*/
border: 1px solid #dcdcdc;
cursor: pointer;
display: inline-block;
font-weight: 400;
/* padding: .75em 1em; */
text-align: center;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
min-width: 110px;
font-size: 14px;
letter-spacing: 2px;
line-height: 30px;
height: 50px;
text-align: center;
text-transform: none;
}
.btn-radio:hover {
border: 1px solid #1e73e9 !important;
}
是否有一些我可以应用的样式,或者有什么替代方法可以做到这一点?
【问题讨论】:
标签: css asp.net-mvc asp.net-mvc-4 bootstrap-4