Bootstrap 4 间距,为什么按钮没有版本 3 中的垂直 space?
Boostrap 4 spacing, why doesn't button have vertical space as in version 3?
版本 3 布局 (https://plnkr.co/edit/XDA9EwMAzH4xDSfZaXvS?p=preview)
<div class="container">
<h1>Confirm your details</h1>
<div class="row">
<div class="col-md-12">
<div class="panel">
<h4 class="panel-heading">We need to confirm your current address details and contact information.</h4>
<p class="panel-body">With supporting text below as a natural lead-in to additional content.</p>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12 text-right">
<p>
<a href="#" class="btn btn-primary">Confirm</a>
</p>
</div>
</div>
</div>
版本 4 布局 (https://plnkr.co/edit/LDy00Kk6eVHDq85ZqjgQ?p=preview)
<div class="container">
<h1>Confirm your details</h1>
<div class="row">
<div class="col">
<div class="card">
<div class="card-block">
<h4 class="card-title">We need to confirm your current address details and contact information.</h4>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12 text-right">
<p>
<a href="#" class="btn btn-primary">Confirm</a>
</p>
</div>
</div>
</div>
为什么按钮没有垂直 space,我应该如何在 Bootstrap v4 中添加它?
根据此 link "Migrating to v4 - Bootstrap 4" 面板已被删除,它是提供伪 HR 的面板和它下面的 margin/padding。
因为它现在使用的是卡片,所以我认为您已经丢失了额外的 css 格式,这只是在前面的卡片周围应用边距的情况。
注意:"Avoid margin-top. Vertical margins can collapse, yielding unexpected results." Boostrap Reboot Approach
找到答案:
https://v4-alpha.getbootstrap.com/utilities/spacing/
基本上,他们添加了用于添加边距和填充的符号,以便您可以根据屏幕大小添加不同的量。例如,我想在顶部('t')的div为小('-sm')大小的屏幕。我也希望它是默认间距 ('-3'):
<div class="mt-sm-3"> <!-- footer nav -->
<a class="btn btn-primary" href="#">Confirm</a>
</div>
版本 3 布局 (https://plnkr.co/edit/XDA9EwMAzH4xDSfZaXvS?p=preview)
<div class="container">
<h1>Confirm your details</h1>
<div class="row">
<div class="col-md-12">
<div class="panel">
<h4 class="panel-heading">We need to confirm your current address details and contact information.</h4>
<p class="panel-body">With supporting text below as a natural lead-in to additional content.</p>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12 text-right">
<p>
<a href="#" class="btn btn-primary">Confirm</a>
</p>
</div>
</div>
</div>
版本 4 布局 (https://plnkr.co/edit/LDy00Kk6eVHDq85ZqjgQ?p=preview)
<div class="container">
<h1>Confirm your details</h1>
<div class="row">
<div class="col">
<div class="card">
<div class="card-block">
<h4 class="card-title">We need to confirm your current address details and contact information.</h4>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12 text-right">
<p>
<a href="#" class="btn btn-primary">Confirm</a>
</p>
</div>
</div>
</div>
为什么按钮没有垂直 space,我应该如何在 Bootstrap v4 中添加它?
根据此 link "Migrating to v4 - Bootstrap 4" 面板已被删除,它是提供伪 HR 的面板和它下面的 margin/padding。
因为它现在使用的是卡片,所以我认为您已经丢失了额外的 css 格式,这只是在前面的卡片周围应用边距的情况。
注意:"Avoid margin-top. Vertical margins can collapse, yielding unexpected results." Boostrap Reboot Approach
找到答案:
https://v4-alpha.getbootstrap.com/utilities/spacing/
基本上,他们添加了用于添加边距和填充的符号,以便您可以根据屏幕大小添加不同的量。例如,我想在顶部('t')的div为小('-sm')大小的屏幕。我也希望它是默认间距 ('-3'):
<div class="mt-sm-3"> <!-- footer nav -->
<a class="btn btn-primary" href="#">Confirm</a>
</div>