Home > Web Front-end > CSS Tutorial > What to do if css height:auto doesn't work

What to do if css height:auto doesn't work

藏色散人
Release: 2023-01-04 09:38:36
Original
3350 people have browsed it

css height:auto solution does not work: 1. Use chrome to find the parent css attribute of the overridden attribute and delete it; 2. Add "zoom:1;overflow:hidden;" to the parent element; " statement is sufficient.

What to do if css height:auto doesn't work

The operating environment of this tutorial: windows7 system, Chrome76.0&&CSS3 version, Dell G3 computer.

Related recommendations: "css video tutorial"

css height:auto doesn't work. How to solve it?

Maybe because the parent element is in a floating state, the floating will be separated from the document flow, and the two internal layers will not be limited to the parent layer, so the parent layer does not know the internal height, but cleaning the floats can " Pull” back.

Two solutions:

① Use chrome to find the parent css attribute of the overridden attribute and delete it.

②The parent element plus zoom:1;overflow:hidden;

zoom:1 will trigger the haslayout of ie (ie8 or below), just enough to clean up the float; overflow:hidden; will affect other It works for browsers (actually it will also work for ie7).

When the parent DIV has a fixed height, it will trigger the haslayout of ie (ie8 or below) like zoom:1;, but the auto value will not.

The above is the detailed content of What to do if css height:auto doesn't work. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template