我想btn-group-justified
用单选input
字段(http://getbootstrap.com/javascript/#buttons-examples)设计原始 Bootstrap 的样式。
原始样式如下所示:
但我想让每个按钮都变成方形按钮,并在它们之间给它们一些空白。像这样的东西:
我正在尝试从 Bootstrap 示例中修改一些 html 标记
[data-toggle="buttons"] .btn>input[type="radio"] {
display: none;
}
.category-select .btn-container {
position: relative;
width: 19%;
padding-bottom: 19%;
float: left;
height: 0;
margin: 1%;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.btn-container .btn,
.btn-container .btn input {
max-width: 100%;
}
<div class="btn-group-justified category-select" data-toggle="buttons">
<div class="btn-container">
<label class="btn category category-one">
<input type="radio" name="options" id="option1"> One
</label>
</div>
<div class="btn-container">
<label class="btn category category-two">
<input type="radio" name="options" id="option2"> Two
</label>
</div>
<div class="btn-container">
<label class="btn category category-three">
<input type="radio" name="options" id="option3"> Three
</label>
</div>
<div class="btn-container">
<label class="btn category category-four">
<input type="radio" name="options" id="option4"> Four
</label>
</div>
<div class="btn-container">
<label class="btn category category-five">
<input type="radio" name="options" id="option5"> Five
</label>
</div>
</div>
但当然,这个 CSS 不会像我想要的那样设置我的按钮样式......
我想要实现的功能是有 5 个按钮,水平对齐,响应式(在所有浏览器尺寸下都是方形)并且表现得像单选按钮组。