I have a simple web page with some Lipsum content that is centered on the page. The page works fine in Chrome and Firefox. If I reduce the size of the window, the content fi
Just in case someone gets here with the same issue I had, which is not specifically addressed in previous comments.
I had margin: auto
on the inner element which caused it to stick to the bottom of it's parent (or the outer element).
What fixed it for me was changing the margin to margin: 0 auto;
.
This is a known bug that appears to have been fixed internally at Microsoft.
https://connect.microsoft.com/IE/feedback/details/802625/min-height-and-flexbox-flex-direction-column-dont-work-together-in-ie-10-11-preview
If you can define the parent's width and height, there's a simpler way to centralize the image without having to create a container for it.
For some reason, if you define the min-width, IE will recognize max-width as well.
This solution works for IE10+, Firefox and Chrome.
<div>
<img src="http://placehold.it/350x150"/>
</div>
div {
display: -ms-flexbox;
display: flex;
-ms-flex-pack: center;
justify-content: center;
-ms-flex-align: center;
align-items: center;
border: 1px solid orange;
width: 100px;
height: 100px;
}
img{
min-width: 10%;
max-width: 100%;
min-height: 10%;
max-height: 100%;
}
https://jsfiddle.net/HumbertoMendes/t13dzsmn/
I found that ie browser have problem to vertically align inner containers, when only the min-height style is set or when height style is missing at all. What I did was to add height style with some value and that fix the issue for me.
for example :
.outer
{
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
/* Center vertically */
align-items: center;
/*Center horizontaly */
justify-content: center;
/*Center horizontaly ie */
-ms-flex-pack: center;
min-height: 220px;
height:100px;
}
So now we have height style, but the min-height will overwrite it. That way ie is happy and we still can use min-height.
Hope this is helpful for someone.