css 响应列相同高度的CSS

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css 响应列相同高度的CSS相关的知识,希望对你有一定的参考价值。

/* USAGE
<div class="row">
  <div class="row-height">
    <div class="col-xs-2 col-xs-height col-xs-middle">
      <div class="inside"></div>
    </div>
    <div class="col-xs-4 col-lg-5 col-xs-height col-xs-middle">
      <div class="inside"></div>
    </div>
  </div>
</div>
*/

.inside-full-height {
  /*
  // if you want to give content full height give him height: 100%;
  // with content full height you can't apply margins to the content
  // content full height does not work in ie http://stackoverflow.com/questions/27384433/ie-display-table-cell-child-ignores-height-100
  */  
  height: 100%; margin-top: 0; margin-bottom: 0;
}

/* columns of same height styles */
.row-height {display: table; table-layout: fixed; height: 100%; width: 100%;}
.col-height {display: table-cell; float: none; height: 100%;}
.col-top {vertical-align: top;}
.col-middle {vertical-align: middle;}
.col-bottom {vertical-align: bottom;}

@media (min-width: 480px) {
  .row-xs-height {display: table; table-layout: fixed; height: 100%; width: 100%;}
  .col-xs-height {display: table-cell; float: none; height: 100%;}
  .col-xs-top {vertical-align: top;}
  .col-xs-middle {vertical-align: middle;}
  .col-xs-bottom {vertical-align: bottom;}
}

@media (min-width: 768px) {
  .row-sm-height {display: table; table-layout: fixed; height: 100%; width: 100%;}
  .col-sm-height {display: table-cell; float: none; height: 100%;}
  .col-sm-top {vertical-align: top;}
  .col-sm-middle {vertical-align: middle;}
  .col-sm-bottom {vertical-align: bottom;}
}

@media (min-width: 992px) {
  .row-md-height {display: table; table-layout: fixed; height: 100%; width: 100%;}
  .col-md-height {display: table-cell; float: none; height: 100%;}
  .col-md-top {vertical-align: top;}
  .col-md-middle {vertical-align: middle;}
  .col-md-bottom {vertical-align: bottom;}
}

@media (min-width: 1200px) {
  .row-lg-height {display: table; table-layout: fixed; height: 100%; width: 100%;}
  .col-lg-height {display: table-cell; float: none; height: 100%;}
  .col-lg-top {vertical-align: top;}
  .col-lg-middle {vertical-align: middle;}
  .col-lg-bottom {vertical-align: bottom;}
}

以上是关于css 响应列相同高度的CSS的主要内容,如果未能解决你的问题,请参考以下文章

仅使用 CSS3/HTML5 的响应式等高列

css 相同的高度列 - Flexbox

使用 HTML/CSS(响应式设计)使可变数量的 div 并排放置在相同的高度上?

在两列页面上,如何使用 CSS 或 Javascript 将左侧 div 增长到与右侧 div 相同的高度?

HTML5/CSS 根据其他列相互高度对齐列表项

DIV+CSS布局,怎么实现两列高度会一致,其中左例随内容长度而定。