【问题标题】:Leaving an empty col-md-1 between two columns in Bootstrap for spacing?在 Bootstrap 的两列之间留下一个空的 col-md-1 以留出间距?
【发布时间】:2021-09-02 02:39:03
【问题描述】:
  <div class="row justify-content-center">
    <div class="col-md-4">
        Column width of md-4
    </div>

    <div class="col-md-1 .d-sm-none">
        <!-- Gap between columns -->
    </div>

    <div class="col-md-4">
        Column width of md-4
    </div>
</div>

这是在这两个列之间间隔一个空 col-md-1 的正确方法吗?并使用 .d-sm-none 将其隐藏在移动设备上。还是有更好/更清洁的方法来做到这一点?

【问题讨论】:

    标签: html css bootstrap-4 spacing


    【解决方案1】:

    是的你可以试试这种方式

    <div class="row justify-content-center">
        <div class="col-md-4">
            Column width of md-4
        </div>
        <div class="offset-md-1 col-md-4">
            Column width of md-4
        </div>
    </div>
    

    https://jsfiddle.net/lalji1051/hyp84gLu/2/

    【讨论】:

    • 谢谢,offset-md-1 只会显示在中等屏幕和更高的屏幕上,对吧?所以在移动端它消失了
    • offset-md-1 will only show on medium screens and higher right?
    猜你喜欢
    • 2016-08-30
    • 1970-01-01
    • 2021-12-20
    • 2021-02-13
    • 2012-06-28
    • 1970-01-01
    • 2015-10-01
    • 1970-01-01
    • 2021-02-05
    相关资源
    最近更新 更多