【发布时间】:2018-09-29 05:45:10
【问题描述】:
按照此处的文档:https://getbootstrap.com/docs/4.1/utilities/flex/#fill
我希望 flex 元素仅填充在小于 sm 的设备上(在示例中与我的列断点对齐)
所以,我会使用类似.flex-fill .flex-sm-nofill
但是没有flex-nofill这样的东西!
我觉得我在这里遗漏了一些明显的东西,但是如何仅使用 vanilla bootstrap 类来解决我的问题?
我知道创建这个新的-nofill 类并不难,但我只是想知道是否已经有解决方案,我就是想不通。
代码示例,在这种情况下,我要填充的元素是按钮:
<div class="row justify-content-between p-3">
<div class="col-12 col-sm-8 col-xl-6 pb-2">
<select class="custom-select" id="layer_select">
<option data-dismiss="modal" value="0">Option1</option></select>
</div>
<div class="col-12 col-sm-3">
<div class="d-flex justify-content-between justify-content-sm-end">
<button class="btn btn-outline-secondary mr-2 flex-fill flex-sm-nofill"><i class="material-icons">file_download</i></button>
<button class="btn btn-outline-secondary flex-fill flex-sm-nofill"><i class="material-icons">filter_list</i></button>
</div>
</div>
</div>
Fiddle(乱码看效果):https://jsfiddle.net/xpvt214o/155315/
我希望按钮与选择并排时具有固定宽度。
【问题讨论】:
标签: html css twitter-bootstrap flexbox bootstrap-4