Why won't my 100% height div stretch to 100% of parent? Not a float

∥☆過路亽.° 提交于 2019-12-08 00:48:05

问题


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. :)



来源:https://stackoverflow.com/questions/16209460/why-wont-my-100-height-div-stretch-to-100-of-parent-not-a-float

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!