javascript - 制作两个高度相等的并排div

标签 javascript html css twitter-bootstrap-3 web-frontend

这是我的最终布局 enter image description here

我想保持左列高度与右列高度相同。我正在简化我的 html,所以对您来说很容易。

<div id="graphsWindow" style="height:100%; ">
<div class="table" style="height: 100%">
    <div class="row" style="margin-left:0px;margin-top:0px; padding-top:0px; padding-bottom:0px; height:100%;">

   <div style="border:groove; margin-left:10px; margin-bottom:0px; padding-bottom:0px; margin-right:2px; border:groove; height:100%" class="col-md-2">
   </div>
   <div class="col-md-9" style="padding-bottom:0px; padding-top:0px; margin-top:0px; margin-left:15px; height:100%">                
   </div>

</div>
</div>

col-md-2 类的 div 包含图片、上一个/下一个按钮和带复选框的列表

col-md-9 类的 div 包含图形和按钮,底部的标签。

我没有在里面的任何地方指定一个固定的高度。如何使两个 div 高度相等?

更新

默认弹出窗口

enter image description here

最大化窗口

enter image description here

最佳答案

使用 bootstrap-4,对于等高列使用 row-eq-height

    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet"/>
    <div class="row row-eq-height">
            <div class="col-xs-4" style="border: 1px solid grey;">.row.row-eq-height &gt; .col-xs-4</div>
            <div class="col-xs-4" style="border: 1px solid grey;">.row.row-eq-height &gt; .col-xs-4<br>this is<br>a much<br>taller<br>column<br>than the others</div>
            <div class="col-xs-4" style="border: 1px solid grey;">.row.row-eq-height &gt; .col-xs-4</div>
          </div>

引用:http://getbootstrap.com.vn/examples/equal-height-columns/

如果您使用的是 bootstrap 3,请添加此 css

@media (min-width: 768px) {
  .row.row-eq-height{
    display: flex;
    flex-wrap: wrap;
  }
}

关于javascript - 制作两个高度相等的并排div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47343344/

相关文章:

javascript - 从客户端在 Telerik RadGrid 中设置 GridCheckBoxColumn

javascript - 如何在 FF 和 IOS 中使用 clip-path 多边形

javascript - 如何在 Aurelia 路由器中定义状态参数

javascript - Meteor Mongo - 使用 $inc 和 upsert 不会增加值(value)

html - 如何将侧边栏设置为固定宽度?

html - 如果标签使用所有图像在每个标签上显示文本+图标,那么如何添加文本以帮助搜索引擎找到标签上的关键字?

html - 将 HTML 页面转换为 PDF 时修复 PDF 辅助功能问题(注释缺少替代描述)

html - 如何阻止第二个元素 "li"(第一个 ul)具有底部边框

jquery - hasClass 不起作用,在每个相册框上显示 div 单击以通过替换类显示图像

html - 未指定的 margin 问题?