我正在尝试将页面上的两个单选按钮(在一个组中)水平居中。到目前为止,这就是我所拥有的。它不完全是中心。它在左边。向右拉会使它过分偏右。我添加了中心块和文本中心,但是它们根本没有帮助。
有人可以帮忙吗?
<div class="row">
<div class="col-sm-5"> </div>
<div class="col-sm-2">
<div class="btn-group center-block text-center" data-toggle="buttons">
<label class="btn btn-default center-block"><input type="radio">All</label>
<label class="btn btn-default active center-block"><input type="radio">Filtered</label>
</div>
</div>
<div class="col-sm-5"> </div>
</div>
您需要text-center
在父div中,而不是将div居中。
<div class="row">
<div class="col-sm-offset-5 col-sm-2 text-center">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default center-block"><input type="radio">All</label>
<label class="btn btn-default active center-block"><input type="radio">Filtered</label>
</div>
</div>
</div>
另外,您应该使用col-sm-offset-5
代替<div class="col-sm-5"> </div>
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句