缺少CSS Div之间的差距

时间:2017-04-27 13:57:58

标签: css twitter-bootstrap

我遇到了一个小问题我过去一小时都无法解决这个问题,我想在div之间有一个垂直间隙,但我不确定为什么它没有显示,下面是两个图像,第一个是代码目前显示的内容,第二个是显示缺失差距的photoshopped图像,如果有人可以提供帮助我会非常感激,非常感谢

<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

2 个答案:

答案 0 :(得分:2)

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

.mb {
    margin-bottom:15px;
}

然后使用这样的类......

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

此外,请确保嵌套/内部列始终包含在另一个row.

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

Bootstrap 4.x spacing utilities will be included

答案 1 :(得分:1)

你走了:

	<div class="container">
		<div class="row" style="background-color:#a8b2c1;">
			<div class="col-md-6">
				<div class="col-md-12" style="background-color:#6d90c4; margin-bottom: 20px;">
					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>

相关问题