【发布时间】:2025-12-11 13:30:01
【问题描述】:
我有两个按钮组,每个按钮组在一个工具栏中包含两个按钮(总共 4 个按钮),并且希望每个按钮的大小相同,并均匀分布在父 div 中(在本例中为引导列。是否有这样做的简单方法?
JSfiddle:https://jsfiddle.net/jh9sdurg/
第一行是我正在使用的:标签长度不等的按钮,第二行是我希望它看起来如何的示例,但我只能使用相等长度的标签来实现这一点(例如。'a ', 'b', 'c')。
<body>
<div class="container">
<div class="row">
<div class="col-xs-3">
<div class="row">
<div class="btn-toolbar">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default active" id="qwerty">a<input id="qwerty" type="radio"></label><label class="btn btn-default" id="lButton1">aa<input id="qwerty" type="radio"></label>
</div>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default active" id="qwerty">bbbbb<input id="qwerty" type="radio"></label><label class="btn btn-default" id="qwerty">bb<input id="qwerty" type="radio"></label>
</div>
</div>
</div>
</div>
<div class="col-xs-9" style="background: gray;">
col-xs-9
</div>
</div>
<div class="row">
<div class="col-xs-3">
<div class="row no-gutters">
<div class="btn-toolbar">
<div class="btn-group btn-block-3" data-toggle="buttons">
<label class="btn btn-default btn-block-2 active" id="qwerty">aa<input id="qwerty" type="radio"></label><label class="btn btn-default btn-block-2" id="qwerty">aa<input id="qwerty" type="radio"></label>
</div>
<div class="btn-group btn-block-3" data-toggle="buttons">
<label class="btn btn-default btn-block-2 active" id="qwerty">bb<input id="qwerty" type="radio"></label><label class="btn btn-default btn-block-2" id="qwerty">bb<input id="qwerty" type="radio"></label>
</div>
</div>
</div>
</div>
<div class="col-xs-9" style="background: gray;">
col-xs-9
</div>
</div>
</div>
【问题讨论】:
-
如果您不介意它们是全角的,请在
.btn-groups 上使用.btn-group-justified。
标签: html css twitter-bootstrap