html - Safari 和 Bootstrap 4 - 自动网格中断

标签 html twitter-bootstrap grid-layout bootstrap-4

这个 bootstrap 4 代码

<div class="container-fluid">
    <div class="row">
        <div class="col"><small>Some text here</small></div>
        <div class="col"><small>Some text here</small></div>
        <div class="col"><small>Some text here</small></div>
        .... add more columns until they should wrap
        <div class="col"><small>Some text here</small></div>
        <div class="col"><small>Some text here</small></div>
    </div>
</div>

将按预期在 Chrome 和 firefox 中自动换行。但是,在 Safari 中,它不会换行到下一行,而是超出页边距。

有变通办法吗?

请注意 - 根据您的视口(viewport)宽度 - 您必须添加一堆 <div class="col"><small>Some text here</small></div>使效果可见。

最佳答案

您可以尝试使用 flexbox,例如

<div class="container-fluid">
    <div class="row">
        <div class="d-flex p-2"><small>Some text here</small></div>
        <div class="d-flex p-2"><small>Some text here</small></div>
        <div class="d-flex p-2"><small>Some text here</small></div>
        <div class="d-flex p-2"><small>Some text here</small></div>
        <div class="d-flex p-2"><small>Some text here</small></div>
        <div class="d-flex p-2"><small>Some text here</small></div>
        <div class="d-flex p-2"><small>Some text here</small></div>
        <div class="d-flex p-2"><small>Some text here</small></div>
        <div class="d-flex p-2"><small>Some text here</small></div>
        <div class="d-flex p-2"><small>Some text here</small></div>
    </div>
</div>

参见 this fiddle .这可能会或可能不会实现您所追求的 - 您可能会对其进行调整,自 alpha6 以来,Bootstrap 4 flex 支持非常强大。

http://v4-alpha.getbootstrap.com/utilities/flexbox/

关于html - Safari 和 Bootstrap 4 - 自动网格中断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42174385/

相关文章:

jquery - Bootstrap 2的模态插件中心不显示

css - Twitter bootstrap 2 - 自定义按钮样式不起作用

css - Bootstrap 2 - 网格列环绕行为是否与 Bootstrap 3 相同?

css - 使用 col-*-pull 或 col-*-push 时如何 float div 元素?

php - 从 mysql 到 php 获取值(value)时遇到麻烦

javascript - CSS 在 Internet Explorer 中改变颜色

javascript - 当我的进度条值发生变化时,如何更改 css 渐变值?

html - Twitter bootstrap 风格继承与 jinja2

javascript - HTML5 promise : does resolve call end promise

html - 如何设置固定百分比的 bootstrap 4 三列网格