Home >Web Front-end >CSS Tutorial >Why is My Flexbox Container's `min-height` Ignored in Internet Explorer?
Flexbox: Min-Height Ignored in Internet Explorer
When attempting to implement a flex container using standardized flexbox terms in Internet Explorer (IE) versions 10 and 11, users may encounter an issue where the specified min-height property is ignored. This can lead to unexpected behavior, as the container height is not constrained to a minimum value.
Problem:
A flex container with two child divs exhibits unexpected height behavior in IE. The child divs have a height less than 400px, but the container min-height property of 400px is ignored, resulting in a container that does not expand to accommodate the justify-content: space-between property. This prevents the first child div from aligning to the top and the second child div from aligning to the bottom.
Solution:
To resolve this issue in IE 10 and 11, it is necessary to make the flex container itself a flex item. This can be achieved by adding the following CSS to the code:
body { display: flex; flex-direction: column; }
By setting the body element as a flex item, the container div inherits flexbox properties and correctly respects the min-height property.
Revised Example:
The updated code with the flex item fix is available in the revised fiddle:
<div>
The above is the detailed content of Why is My Flexbox Container's `min-height` Ignored in Internet Explorer?. For more information, please follow other related articles on the PHP Chinese website!