【问题标题】:Why is bootstrap changing a col-md div to 100% width @max-width:991?为什么引导程序将 col-md div 更改为 100% 宽度 @max-width:991?
【发布时间】:2015-07-18 02:47:48
【问题描述】:

我正在使用引导程序,因此它会将我的 div 很好地彼此相邻,但是每当我将窗口大小调整为 991px 宽度时,它会使这些 div 宽度为 100% ...

代码:

<div class="row">
  <div class="col-md-2">
     <img src="path..."  style="width: 100%; height: auto">
  </div>
  <div class="col-md-2">
     <img src="path..."  style="width: 100%; height: auto">
  </div>
  <div class="col-md-2">
     <img src="path..."  style="width: 100%; height: auto">
  </div>
  <div class="col-md-2">
     <img src="path..."  style="width: 100%; height: auto">
  </div>
  <div class="col-md-2">
     <img src="path..."  style="width: 100%; height: auto">
  </div>
  <div class="col-md-2">
     <img src="path..."  style="width: 100%; height: auto">
  </div>
</div>

图片(调整为991px宽度后):

【问题讨论】:

    标签: css twitter-bootstrap media-queries


    【解决方案1】:

    Bootstrap 3 是移动优先的,这意味着除非您另有说明,否则一切都会像在小型设备上一样处理。要更改列的断点,请使用较小的前缀:

    col-xs-2
    

    col-sm-2
    

    http://getbootstrap.com/css/#grid

    另外,使用 Bootstrap 的响应式图像类,而不是图像上的内联样式(糟糕):

    class="img-responsive"
    

    http://getbootstrap.com/css/#images

    【讨论】:

    • 内联样式仅用于演示 :),非常感谢!!
    猜你喜欢
    • 1970-01-01
    • 2018-10-01
    • 1970-01-01
    • 2017-08-17
    • 1970-01-01
    • 1970-01-01
    • 2014-09-09
    • 2018-12-03
    • 1970-01-01
    相关资源
    最近更新 更多