带有独立按钮的Bootstrap按钮组

时间:2019-04-04 12:18:14

标签: css twitter-bootstrap

我想使用Bootstraps按钮组创建单选按钮表单,但是我不希望将按钮分组在一起。我需要它们每个角上都有圆角,并在它们之间填充。

3 个答案:

答案 0 :(得分:1)

您可以使用类似的东西

<div class="radio">
  <label><input type="radio" name="optradio" checked>Option 1</label>
</div>
<div class="radio">
  <label><input type="radio" name="optradio">Option 2</label>
</div>
<div class="radio disabled">
  <label><input type="radio" name="optradio" disabled>Option 3</label>
</div>

答案 1 :(得分:1)

      // ...
      {
        test: /\.(png|ico|gif)?$/,
        loader: 'file-loader',
        options: {
            name: '[name].[ext]',
            outputPath: 'static/images',
        }
      }
      // ...
.radio input[type="radio"]{display:none;}

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css">


<div class="radio">
  <label class="btn btn-success"><input type="radio" name="optradio" checked>Option 1</label>
</div>
<div class="radio">
  <label class="btn btn-success"><input type="radio" name="optradio">Option 2</label>
</div>
<div class="radio">
  <label class="btn btn-success"><input type="radio" name="optradio">Option 3</label>
</div>

答案 2 :(得分:0)

我只是编写了一个基本的引导单选按钮组。试试这个,希望对您有所帮助。谢谢

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<div class="btn-group btn-group-toggle" data-toggle="buttons">
  <label class="btn btn-secondary m-2 rounded active">
    <input type="radio" name="options" checked> Active Option
  </label>
  <label class="btn btn-secondary m-2 rounded">
    <input type="radio" name="options"> Option
  </label>
  <label class="btn btn-secondary m-2 rounded">
    <input type="radio" name="options"> Option
  </label>
</div>

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>