twitter-bootstrap-4 – 在Bootstrap 4中做什么偏移?

前端之家收集整理的这篇文章主要介绍了twitter-bootstrap-4 – 在Bootstrap 4中做什么偏移?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在关注网页创建教程,教师用“col-sm-offset-1”类创建了一个部门.这对于该类中div的内容有什么作用?这是完整的代码

< div class =“col-sm-10 col-sm-offset-1”> https://jsfiddle.net/zmtmphtq/

解决方法

根据bootstrap 4.0 .offset类可用.

1.使用class .offset See bootstrap offset documentaion

<div class="row">
  <div class="col-md-4">.col-md-4</div>
  <div class="col-md-4 offset-md-4">.col-md-4 .offset-md-4</div>
</div>

2.或者使用class .mr(margin-right).ml(mrgin-left),See bootstrap spacing documentaion

`<div class="row">
   <div class="col-4 mr-5">col-4</div>
   <div class="col-4 ml-5">col-4</div>
</div>`

3.或者创建一个您希望偏移量大的空列

`<div class="row">
  <div class="col-4"></div>
  <div class="col">col-4</div>
 </div>`

4.或使用.mr-auto来偏移下一列

`<div class="row">
    <div class="col-4 mr-auto">col-4</div>
    <div class="col-4">col-4</div>
 </div>`

See the code in this codepen

Note: Bootstrap Alpha v4 does not have the .offset class,Make sure to use Bootstrap 4.0.

猜你在找的Bootstrap相关文章