【发布时间】:2015-07-09 04:10:10
【问题描述】:
所以基本上我有 2 个按钮,我想在它们之间放置 20px 的空间。在移动设备上,虽然按钮是堆叠的并且它们偏离中心 20 像素。有人有想法么?我听说有人说使用 btn-toolbar 类,但它似乎不起作用..
【问题讨论】:
标签: css twitter-bootstrap button margins
所以基本上我有 2 个按钮,我想在它们之间放置 20px 的空间。在移动设备上,虽然按钮是堆叠的并且它们偏离中心 20 像素。有人有想法么?我听说有人说使用 btn-toolbar 类,但它似乎不起作用..
【问题讨论】:
标签: css twitter-bootstrap button margins
在你的 CSS 文件的底部抛出这个媒体查询:
@media screen and (max-width: 767px) {
// declare CSS rules for your target buttons
}
【讨论】:
只需添加一些自定义 CSS
//Mobile First Responsive View full width Stacked Buttons
.button-holder .btn{margin-right:0;width:100%;display:block;}
@media screen and (min-width: 480px){
//Tablet/Desktop View left aligned buttons
.button-holder .btn{width:auto;margin-right:20px;display:inline-block;}
}
【讨论】: