首页>Program>source

我遇到这样一种情况,要求我不限制一行中的列数,因为可能会从管理员的位置向该区域添加多个内容块。

默认情况下,BS3的行为告诉12列div不浮动,这会使它们越过较小的浮动div的顶部.因此,我为系统编写了一个替代类,并认为如果其他人遇到问题,我会分享。

如果有人有更好的主意或建议,我很想感觉自己不是在入侵Bootstrap ...但是这就是我的解决方法。

  /* col-xs float fix for large column groups */  
  .large-group .col-xs-12 {
    float: left;    
  }
  /* col-sm float fix for large column groups */    
  @media (min-width: 768px) {    
    .large-group .col-sm-12 {    
      float: left;    
    }    
  }
  /* col-md float fix for large column groups */    
  @media (min-width: 992px) {    
    .large-group .col-md-12 {    
      float: left;    
    }    
  }
  /* col-lg float fix for large column groups */    
  @media (min-width: 1200px) {
    .large-group .col-lg-12 {    
      float: left;    
    }    
  }
<div class="container">
  <div class="row large-group" style="background-color:#ebebeb;">    
    <div class="col-xs-9"><div style="background-color:#babeee;"><p>col 9</p></div></div>    
    <div class="col-xs-3"><div style="background-color:#fefeeb;"><p>col 3</p></div></div>    
    <div class="col-xs-12"><div style="background-color:#bada55;"><p>col 12</p></div></div>    
  </div>    
</div>
最新回答
  • 2021-1-11
    1 #

    .row中使用少于12个列单元的更多并没有错 ,实际上,Bootstrap文档指出:

    "If more than 12 columns are placed within a single row, each group of extra columns will, as one unit, wrap onto a new line"

    文档中还提供了一些示例来说明为什么需要进行"列包装":https://getbootstrap.com/docs/3.3/css/#grid-example-wrapping.单个 .row.中可以包含12个以上的单元是可以的 标签,请记住您可能需要使用响应式重置. 12个单位是视觉行的限制(水平贯穿视口),但不一定是 .row div只是一组列。

    了解有关Bootstrap网格的更多信息,以及为什么经常需要连续12个以上。

  • 2021-1-11
    2 #

    Bootstrap was made for a 12-col usage.

    如果要具有更多列,则需要在Bootstrap Less变量的帮助下定义自定义响应网格(请参见此处).您主要需要更改这些变量:

      @grid-columns :网格中的列数。

      @grid-gutter-width 列之间的填充.被分为左右两半。

      p

      如果需要大量网格的灵活性和响应性,则可以使用dead-simple-grid https://github.com/mourner/dead-simple-grid,还可以尝试尽量减少在网格和 让

      max-width:100%;
      float:left;
      

  • objective c:仅限某些iOS目标设备进行App Store提交
  • sql:如果与ODBC连接,MS Access是否支持" CASE wHEN"子句?