In IE I am having a problem where my flex column is stretched for unknown reasons. I need the image height and width of each flex item to always be the same and also be responsive so I need them at 100%. I also need the flex footer to always be at the same level as the others, stuck to the bottom of the container regardless of whether the flex-name spans more than 1 line.
.flex-container {
display: flex;
border: 1px solid red;
}
.flex-item-wrapper {
display: flex;
border: 1px solid green;
flex-direction: column;
width: 185px;
}
.link-spanner {
position: absolute;
height: 100%;
width: 100%;
top: 0;
left: 0;
}
.flex-header {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: auto;
}
.image-container {
margin-top: 5px;
position: relative;
width: 100%;
}
img {
height: 100%;
width: 100%;
}
.flex-item-name {
max-width: 100%;
text-align: center;
}
<div class="wrapper">
<div class="flex-container">
<div class="flex-item-wrapper">
<a href='#' class="link-spanner"></a>
<div class="flex-header">
<div class="image-container">
<img class="picture" src="http://www.picgifs.com/clip-art/cartoons/super-mario/clip-art-super-mario-832109.jpg" alt="">
</div>
</div>
<div class="flex-name">Bingobongo Bongobingobongo</div>
<div class="flex-footer">
<button>submit</button>
</div>
</div>
<div class="flex-item-wrapper">
<a href='#' class="link-spanner"></a>
<div class="flex-header">
<div class="image-container">
<img class="picture" src="http://www.picgifs.com/clip-art/cartoons/super-mario/clip-art-super-mario-832109.jpg" alt="">
</div>
</div>
<div class="flex-name">Bingobongo Bongo</div>
<div class="flex-footer">
<button>submit</button>
</div>
</div>
<div class="flex-item-wrapper">
<a href='#' class="link-spanner"></a>
<div class="flex-header">
<div class="image-container">
<img class="picture" src="http://www.picgifs.com/clip-art/cartoons/super-mario/clip-art-super-mario-832109.jpg" alt="">
</div>
</div>
<div class="flex-name">Bingobongo Bongobingobongo</div>
<div class="flex-footer">
<button>submit</button>
</div>
</div>
</div>
</div>
jsfiddle
Internet Explorer doesn't fully support Flexbox due to: Partial support is due to large amount of bugs present (see known issues).
Getting the child of a flex-item to fill height 100% Set position: absolute; on the child. You can then set width/height as required (100% in my sample).
On the parent element try to add:
display: flex;
align-items: stretch;
flex-direction: column;
min-height: 1px;
-ms-flex-negative: 0;
This works for me.
In addition to this post/answer, if you add min-height: 1px;
to both the .flex-header
and the .image-container
it will work in IE11 in your case as well ..
.. and I don't know why either, though according to this Microsoft bug report github post, it force IE to recalculate the sizes based on the image.
Updated fiddle
.flex-header {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: auto;
min-height: 1px;
}
.image-container {
margin-top: 5px;
position: relative;
width: 100%;
min-height: 1px;
}
Actually, it also works if you add -ms-flex-negative: 0;
to both the .flex-header
and the .image-container
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With