css - 缺少 CSS Div 之间的间隙

标签 css twitter-bootstrap

我遇到了一个小问题,过去一个小时我一直无法解决,我想要 div 之间的垂直间隙,但我不确定为什么没有显示,下面是两张图片,第一张是代码当前显示的内容,第二个是显示缺失间隙的 Photoshop 图片,如果有人可以提供帮助,我将不胜感激,非常感谢

<div class="container">
<div class="row" style="background-color:#a8b2c1;">
    <div class="col-md-6">
        <div class="col-md-12" style="background-color:#6d90c4;">
            Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
        </div>
        <div class="col-md-12" style="background-color:#6d90c4;">
            Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
        </div>
    </div>
    <div class="col-md-6">
        <div class="col-md-12" style="background-color:#4d6487;">
            It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
        </div>
    </div>
</div>
</div>

Gap missing

Example shown with gap

最佳答案

这就是 Bootstrap 的工作原理。列之间没有垂直间距。您可以使用自定义类简单地添加 margin-bottom

.mb {
    margin-bottom:15px;
}

然后像这样使用类...

<div class="col-md-12 mb"></div>

此外,确保嵌套/内部列始终包含在另一个行中。

http://www.codeply.com/go/16c6c71iAq

Bootstrap 4.x 中,spacing utilities will be included

关于css - 缺少 CSS Div 之间的间隙,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43659998/

相关文章:

html - bootstrap 3 grid offset 占用水平空间

jquery - 树形菜单中的圆 Angular

html - 如何定位图像列表标记,使文本垂直居中

html - 添加自定义字体 ttf 不起作用

html - 做什么 <form action =“.” >

javascript - chop Twitter Bootstrap 轮播的文本

css - Sass::SyntaxError:颜色必须有三位或六位数字: '#b'

ruby-on-rails - Twitter Bootstrap Gems for Rails 的比较

HTML 表格 - 最大宽度不适用于 td 后代

css - 未应用外部 CSS