转载

栅格 Responsive column resets

Responsive column resets

With the four tiers of grids available you're bound to run into issues where, at certain breakpoints, your columns don't clear quite right as one is taller than the other. To fix that, use a combination of a .clearfix and our responsive utility classes.

.col-xs-6 .col-sm-3
Resize your viewport or check it out on your phone for an example.
.col-xs-6 .col-sm-3
.col-xs-6 .col-sm-3
.col-xs-6 .col-sm-3
  1. <div class="row"> 
  2.   <div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3</div> 
  3.   <div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3</div> 
  4.  
  5.   <!-- Add the extra clearfix for only the required viewport --> 
  6.   <div class="clearfix visible-xs-block"></div> 
  7.  
  8.   <div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3</div> 
  9.   <div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3</div> 
  10. </div> 

In addition to column clearing at responsive breakpoints, you may need to reset offsets, pushes, or pulls. See this in action in the grid example.

  1. <div class="row"> 
  2.   <div class="col-sm-5 col-md-6">.col-sm-5 .col-md-6</div> 
  3.   <div class="col-sm-5 col-sm-offset-2 col-md-6 col-md-offset-0">.col-sm-5 .col-sm-offset-2 .col-md-6 .col-md-offset-0</div> 
  4. </div> 
  5.  
  6. <div class="row"> 
  7.   <div class="col-sm-6 col-md-5 col-lg-6">.col-sm-6 .col-md-5 .col-lg-6</div> 
  8.   <div class="col-sm-6 col-md-5 col-md-offset-2 col-lg-6 col-lg-offset-0">.col-sm-6 .col-md-5 .col-md-offset-2 .col-lg-6 .col-lg-offset-0</div> 
  9. </div>
正文到此结束
Loading...