Why won't my 100% height div stretch to 100% o

2019-05-19 04:58发布

问题:

http://thestleonardsacademy.org/stlan/extracurricular.php

The body and html are 100%, the #content container is 100%, but the child #newstiles won't match the 100% height that I set. I can set a fixed height, which increases it beyond the auto height that it currently seems to use, but 100% does nothing.

I must be going mad, or missing something very obvious!

回答1:

Try to add

height: 100%;

to your #content style. You only defined max-height and min-height.



回答2:

Try to set the position to "absolute" on #newstiles. Then the height is 100%, but then you get some the ugly scrollbar as the total page height would be 100% + your header.

I suggest you remove the height and width, and replace them with position absolute, top: 120px (the size of your top navigation) and bottom: 0px.

Hope this was what you were looking for. :)



标签: html css height