CSS相邻选择器嵌套



Bootstrap按钮块使用相邻的选择器来划分按钮。

.btn-block + .btn-block {
margin-top: 5px;
}

我有一个圆顶树,我的引导btn块将嵌套在垫片中。如何使用Bootstrap使用的相同邻接规则为元素创建边距?

<div class="col-md-4">
<span id=" "><input type="hidden" name=" " id=" ">
<input type="submit" name=" " value=" " onclick=" " id=" " class="btn btn-primary btn-block"></span>
<span id=" "><input type="hidden" name=" " id=" ">
<input type="submit" name=" " value=" " onclick=" " id=" " class="btn btn-primary btn-block">
</span>
<input type="submit" class=" btn-block btn btn-primary">
<input type="submit" id="ctl00_ctl00_cpContent_cpDetails_efvOrder_tslUsers_btnClear" class=" btn-block btn btn-primary">
</div>

如果我理解正确,您将在另一个元素中有一个引导按钮。所以你可以给每个容器元素一个类,比如btn-container

然后可以使用子选择器.btn-container > .btn-block {为其提供所需的样式。

最新更新