0

我正在尝试实现一个简单的界面,其中有一系列按钮(复选框),它们是组的一部分。

我想拆分组,所以每行最多只能有 3 个。

<div class="container">
  <div class="control-group">
    <p class="pull-left"><label class="control-label" for="Languages">Lingue</label></p>
    <div class="controls">
      <div class="btn-group btn-group-horizontal" data-toggle="buttons-checkbox">
        <input type="checkbox" value="1" id="Languages_0" name="Languages" checked />
        <label class="btn btn-info btn-small active" for="Languages_0">Italiano</label>
        <input type="checkbox" value="2" id="Languages_1" name="Languages" checked />
        <label class="btn btn-info btn-small active" for="Languages_1">Francese</label>
        <input type="checkbox" value="3" id="Languages_2" name="Languages" checked />
        <label class="btn btn-info btn-small active" for="Languages_2">Inglese</label>
        <input type="checkbox" value="4" id="Languages_3" name="Languages"  />
        <label class="btn btn-info btn-small " for="Languages_3">Spagnolo</label>
        <input type="checkbox" value="5" id="Languages_4" name="Languages"  />
        <label class="btn btn-info btn-small " for="Languages_4">Tedesco</label>
        <input type="checkbox" value="6" id="Languages_5" name="Languages"  />
        <label class="btn btn-info btn-small " for="Languages_5">Portoghese</label>
        <input type="checkbox" value="7" id="Languages_6" name="Languages"  />
        <label class="btn btn-info btn-small " for="Languages_6">Bulgaro</label>
        <input type="checkbox" value="8" id="Languages_7" name="Languages"  />
        <label class="btn btn-info btn-small " for="Languages_7">Lettone</label>
      </div>
    </div>
  </div>
</div>

我试图将 span3 放在任何地方,但它似乎只在 IE 中有效。你可以在这里看到小提琴。

4

1 回答 1

3

您需要分解每组三个复选框/标签,并div使用类名将它们放在自己的位置controls

<div class="container">
    <div class="control-group">
        <p class="pull-left">
            <label class="control-label" for="Languages">Lingue</label>
        </p>
        <div class="controls">
            <div class="btn-group btn-group-horizontal" data-toggle="buttons-checkbox">
                <input type="checkbox" value="1" id="Languages_0" name="Languages" checked
                />
                <label class="btn btn-info btn-small active" for="Languages_0">Italiano</label>
                <input type="checkbox" value="2" id="Languages_1" name="Languages"
                checked />
                <label class="btn btn-info btn-small active" for="Languages_1">Francese</label>
                <input type="checkbox" value="3" id="Languages_2" name="Languages"
                checked />
                <label class="btn btn-info btn-small active" for="Languages_2">Inglese</label>/></div>
        </div>
        <div class="controls">
            <div class="btn-group btn-group-horizontal" data-toggle="buttons-checkbox">
                <input type="checkbox" value="4" id="Languages_3" name="Languages" />
                <label class="btn btn-info btn-small " for="Languages_3">Spagnolo</label>
                <input type="checkbox" value="5" id="Languages_4" name="Languages"
                />
                <label class="btn btn-info btn-small " for="Languages_4">Tedesco</label>
                <input type="checkbox" value="6" id="Languages_5" name="Languages"
                />
                <label class="btn btn-info btn-small " for="Languages_5">Portoghese</label>
            </div>
        </div>
        <div class="controls">
            <div class="btn-group btn-group-horizontal" data-toggle="buttons-checkbox">
                <input type="checkbox" value="7" id="Languages_6" name="Languages" />
                <label class="btn btn-info btn-small " for="Languages_6">Bulgaro</label>
                <input type="checkbox" value="8" id="Languages_7" name="Languages"
                />
                <label class="btn btn-info btn-small " for="Languages_7">Lettone</label>
            </div>
        </div>
    </div>
</div>

这是 jsFiddle 上的一个工作示例

于 2013-02-08T18:45:33.997 回答