html - IE - Flexbox 嵌套的 div 继承父级高度

标签 html css internet-explorer flexbox

<分区>

我有一个 flexbox 网格布局,在一列中有一个高图像,在另一列中有两个较短的图像相互堆叠。

这是它在 Chrome 中的样子:

This is what it looks like it Chrome.

在 Internet Explorer 中,两个较小的嵌套图像/div 的高度会拉伸(stretch)到第一列的高度。

Image here.

如何使包含两个嵌套图像的列保持自己的高度?

h3 {
  margin-bottom: 20px;
}

.grid {
  box-sizing: border-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-flow: row nowrap;
  flex-flow: row nowrap;
  margin-left: -10px;
  margin-right: -10px;
}

.col-4 {
  padding-left: 10px;
  padding-right: 10px;
  box-sizing: border-box;
  -ms-flex: 0 0 auto;
  flex: 0 0 auto;
  flex-basis: 33.33333%;
  max-width: 33.33333%;
}

.executive-container {
  max-width: 1440px;
  margin-top: 0;
  margin-bottom: 0;
  margin-left: auto !important;
  margin-right: auto !important;
  padding: 0 5.21%;
  padding-top: 80px;
  padding-bottom: 0;
}

.executive-container .box {
  margin-bottom: 20px;
  -ms-flex-order: 1;
  order: 1;
}

.executive-container .box .box-inner {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-direction: column;
  flex-direction: column;
  -ms-flex-pack: justify;
  justify-content: space-between;
  height: 100%;
}

.resimg {
  width: 100%;
  height: auto;
  vertical-align: bottom;
}

.executive-container .box .board-member {
  position: relative;
}

.executive-container .box .board-member .board-member-details {
  width: 66%;
  position: absolute;
  bottom: 0;
  left: 0;
  color: red;
  padding: 20px;
  font-size: 1.8rem;
  letter-spacing: 0;
  font-weight: normal;
  font-style: normal;
  line-height: 2.9rem;
  font-weight: 700;
  line-height: 2.1rem;
  letter-spacing: -0.02em;
}
<div class="grid executive-container">
  <div class="box col-4 heading">
    <h3>Executive<br>Leadership<br>Team</h3></div>
  <div class="box col-12_sm-6_md-4">
    <div class="board-member">
      <div class="board-member-details">
        <div class="board-name">Caption</div>
      </div>
      <img src="http://via.placeholder.com/821x1125" alt="" class="resimg portrait-desktop">
    </div>
  </div>
  <div class="box col-4">
    <div class="box-inner">
      <div class="board-member">
        <div class="board-member-details">
          <div class="board-name">Caption</div>
        </div><img src="http://via.placeholder.com/819x536" alt="" class="resimg"></div>
      <div class="board-member">
        <div class="board-member-details">
          <div class="board-name">Caption</div>
        </div><img src="http://via.placeholder.com/819x536" alt="" class="resimg"></div>
    </div>
  </div>
</div>

最佳答案

这有帮助! Flexbox on IE11: image stretched for no reason?

我在 flex-child 上设置了 flex-shrink: 0,它解决了 IE 中的问题。

关于html - IE - Flexbox 嵌套的 div 继承父级高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45626559/

相关文章:

python - 为什么搜索查询表显示表头,而不是 BeautifulSoup (Python) 中的数据?

css - 绝对定位的DIV元素铺满挡住按钮,如何隐藏不可见的挡 block ?

javascript - 通过 AJAX 将数据插入 div 后的 jQuery scrollTop

ruby - 使用 Selenium Webdriver 切换窗口时出错

javascript - 用于条目列表和所选条目的具有不同大小的 Html 下拉列表

html - Header-bg div 100% 并不是真正的 100%

html - 如何在 <ul> 标签周围设置边框?

html - ruby on rails 为什么在 View 中加载 css 时布局没有改变?

javascript - 如何在移动设备和桌面上使用媒体查询?

jquery - 动画在 IE11 上无法正常工作