html - 如何使用 Bootstrap 在按钮之间设置间距

标签 html css twitter-bootstrap

我想在按钮之间设置间距,有没有一种方法可以使用 bootstrap 设置间距,以便它们在不同的屏幕分辨率下保持一致。

我试过使用 margin-left 但这是正确的方法吗??

这是 demo

HTML:

<div class="btn-toolbar text-center well">
    <button type="button" class="btn btn-primary btn-color btn-bg-color btn-sm col-xs-2 margin-left">
      <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> ADD PACKET
    </button>
    <button type="button" class="btn btn-primary btn-color btn-bg-color btn-sm col-xs-2 margin-left">
      <span class="glyphicon glyphicon-edit" aria-hidden="true"></span> EDIT CUSTOMER
    </button>
    <button type="button" class="btn btn-primary btn-color btn-bg-color btn-sm col-xs-2 margin-left">
      <span class="glyphicon glyphicon-time" aria-hidden="true"></span> HISTORY
    </button>
    <button type="button" class="btn btn-primary btn-color btn-bg-color btn-sm col-xs-2 margin-left">
      <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> DELETE CUSTOMER
    </button>
</div>

CSS:

.margin-left{
    margin-left: 80px !important;
}

最佳答案

您可以通过使用 bootstrap Spacing 来实现。 Bootstrap Spacing 包括范围广泛的速记响应边距和填充。在下面的示例中,mr-1marginpadding 设置为 $spacer * .25。

例子:

<button class="btn btn-outline-primary mr-1" href="#">Sign up</button>
<button class="btn btn-outline-primary" href="#">Login</button>

您可以在 Bootstrap Spacing 阅读更多内容.

关于html - 如何使用 Bootstrap 在按钮之间设置间距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27689927/

相关文章:

html - 如何在 Bootstrap 的大屏幕右侧制作可折叠的导航栏?

javascript - Bootstrap typeahead,更改 bloodhound 建议引擎使用的数据源

html - 如何在使用 start 属性的有序列表中设置标记样式?

javascript - 如何从选择选项中获取 HTML5 数据值?

html - 如何让两个单杠相互对接

javascript - jQuery 将数据发布到下一页

css - 如何偏移行高基线?

html - 嵌套绝对定位 div 中奇怪的文本换行行为

css - 如何让css3动画永远循环

html - 是否有类似于 View Source Chart 的 Firefox 3 插件?