Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nested flexbox height issue in IE

Tags:

html

css

flexbox

I have nested flexboxes with some images inside, it looks good in Chrome, but in IE you can see the borders on the flex-item-wrapper are not flush against the bottom of the image. By the way, in the layout I will sometimes have several flex-row with many pictures.

.flex-list {
  display: flex;
  flex-direction: column;
}
.flex-row {
  display: flex;
}
.flex-item-wrapper {
  width: 100%;
  border: 1px solid green;
}
.flex-item {
  height: 100%;
  width: 100%;
  border: 1px solid blue;
}
.picture {
  width: 100%;
}
<div class="flex-list">
  <div class="flex-row">
    <div class="flex-item-wrapper">
      <div class="flex-item">
        <a href='#'>
          <img class="picture" src="http://www.picgifs.com/clip-art/cartoons/super-mario/clip-art-super-mario-832109.jpg" alt="">
        </a>
      </div>
    </div>
    <div class="flex-item-wrapper"></div>
    <div class="flex-item-wrapper"></div>
    <div class="flex-item-wrapper"></div>
  </div>
</div>
like image 336
user4584963 Avatar asked Nov 18 '25 03:11

user4584963


1 Answers

This seems to be working:

.flex-row {
  display: flex;
  flex: 0 0 auto; /*added*/
}

or

.flex-row {
  display: flex;
  height: 100%; /*added*/
}

See simplified demo:

.flex-list {
  display: flex;
  flex-direction: column;
}
.flex-row {
  display: flex;
  flex: 0 0 auto;
}
.flex-item {
  flex: 1;
  border: 1px solid blue;
}
.picture {
  width: 100%;
  height: auto;
}
<div class="flex-list">
  <div class="flex-row">
    <div class="flex-item">
      <a href='#'>
        <img class="picture" src="http://www.picgifs.com/clip-art/cartoons/super-mario/clip-art-super-mario-832109.jpg" alt="">
      </a>
    </div>
    <div class="flex-item"></div>
    <div class="flex-item"></div>
    <div class="flex-item"></div>
  </div>
</div>
like image 106
Stickers Avatar answered Nov 20 '25 17:11

Stickers



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!