如何添加边缘顶部类="行"元素使用twitter引导框架?
当前回答
引导3
如果需要在引导中分离行,可以简单地使用.form-group。这将在行底部添加15px的边缘。
在您的例子中,要获得margin top,可以将这个类添加到之前的.row元素中
<div class="row form-group">
/* From bootstrap.css */
.form-group {
margin-bottom: 15px;
}
引导4
您可以使用内置间距类
<div class="row mt-3"></div>
类名中的“t”使它只适用于“顶部”,有类似的类用于底部,左侧,右侧。数字定义了空间大小。
其他回答
我将这些类添加到引导样式表中
.voffset { margin-top: 2px; }
.voffset1 { margin-top: 5px; }
.voffset2 { margin-top: 10px; }
.voffset3 { margin-top: 15px; }
.voffset4 { margin-top: 30px; }
.voffset5 { margin-top: 40px; }
.voffset6 { margin-top: 60px; }
.voffset7 { margin-top: 80px; }
.voffset8 { margin-top: 100px; }
.voffset9 { margin-top: 150px; }
例子
<div class="container">
<div class="row voffset2">
<div class="col-lg-12">
<p>
Vertically offset text.
</p>
</div>
</div>
</div>
引导3
如果需要在引导中分离行,可以简单地使用.form-group。这将在行底部添加15px的边缘。
在您的例子中,要获得margin top,可以将这个类添加到之前的.row元素中
<div class="row form-group">
/* From bootstrap.css */
.form-group {
margin-bottom: 15px;
}
引导4
您可以使用内置间距类
<div class="row mt-3"></div>
类名中的“t”使它只适用于“顶部”,有类似的类用于底部,左侧,右侧。数字定义了空间大小。
引导5
在Bootstrap 5中,你可以这样做:
<div class="row mt-X"></div>
其中X是从0(没有空格)到5(有很多空格)之间的数字。关于不同的边距/填充大小和特定于断点的控件的更多信息,请查看文档。
在Bootstrap 4 alpha+中你可以使用这个
class margin-bottom-5
类的命名格式为:{property}-{sides}-{size}
just take a new class beside every row and apply css of margin-top: 20px;
here is the code below
<style>
.small-top
{
margin-top: 25px;
}
</style>
<div class="row small-top">
<div class="col-md-12">
</div>
</div>