I have a flex "row" that contains 5 flex "cells" that contains an image which is supposed to be aligned in the middle.
It works perfectly in Chrome and Firefox, but it doesn't in IE. It doesn't get the good ratio. In other terms, height:auto
doesn't work in IE when the image is in a flexbox.
I already tried several things like flex:none;
for the image or wrap the image in another div
. Nothing works.
I want it with the good ratio and fully centered:
Here is a jsFiddle: https://jsfiddle.net/z8op323f/5/
.grid-row {
width: 300px;
height: 300px;
display: flex;
margin: auto;
}
.grid-cell {
height: 100%;
width: 25%;
transition: box-shadow 2s;
display: flex;
}
img {
width: 60%;
margin: auto;
height: auto !important;
min-height: 1px;
}
.long {
width: 80%;
height: auto !important;
}
<div class="grid-row">
<div class="grid-cell">
<img class="long" src="http://placehold.it/350x500">
</div>
<div class="grid-cell">
<img class="long" src="http://placehold.it/350x500">
</div>
<div class="grid-cell">
<img class="long" src="http://placehold.it/350x500">
</div>
<div class="grid-cell">
<img class="long" src="http://placehold.it/350x500">
</div>
<div class="grid-cell">
<img class="long" src="http://placehold.it/350x500">
</div>
</div>