IE8 Height 100% Error

Has anyone heard of an error that occurs with IE8 when applying percent height to html and body using CSS? I see a white background when a tile pattern should be applied.

html, body { margin: 0; padding: 0; height: 100%; } body { background-color: #666; background-image: url('../images/body/bg_pattern.gif'); } 
+4
source share
2 answers

IE8 interprets the height element closer to standards than IE7. Statement

`Height: 100%

Pretty much ignored. Percentage heights are based on the height of their parent element. If the parent does not have an explicit height, the percentage is ignored and set to "Auto". This can be found on w3.org .

If the page displayed is empty, the body will have a height of 0 and you will see the default background.

+3
source

To prevent generated height:0 when you float children, set

 overflow:hidden; position: relative; 

for the parent.

+2
source

Source: https://habr.com/ru/post/1336647/


All Articles