Home > Web Front-end > CSS Tutorial > Why Does IE Ignore My Flex Container's `min-height` Property?

Why Does IE Ignore My Flex Container's `min-height` Property?

Patricia Arquette
Release: 2024-12-02 14:09:12
Original
751 people have browsed it

Why Does IE Ignore My Flex Container's `min-height` Property?

IE Ignoring Flex Container's Minimum Height

In Internet Explorer 10 and 11, flex containers can exhibit unexpected behavior when it comes to the min-height property. While flex containers should adhere to the defined minimum height, IE browsers ignore it.

To address this issue, a workaround exists by making the flex container a flex item itself. By adding the following code to your CSS:

body {
  display: flex;
  flex-direction: column;
}
Copy after login

you effectively transform the entire page into a flex container. This enables the flex container to respect the min-height property in IE while maintaining the intended layout.

Example:

Consider a flex container with two child divs where the container has a minimum height of 400px and the child divs are not larger than 400px. In Chrome and Firefox, the layout would be as expected with one child at the top and the other at the bottom. However, in IE, the container would collapse to the height of its contents, ignoring the min-height property.

Solution:

To resolve this issue, implement the workaround by making the body a flex container. The modified code would look like:

<div>
Copy after login

The above is the detailed content of Why Does IE Ignore My Flex Container's `min-height` Property?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template