div是否垂直扩展以适合他们的子div? [英] Do divs expand vertically to fit their children divs?
问题描述
我无法让我的div与他们的子div一起垂直扩展。
我有这样的事情:
< div class = 'headerWrapper' >
< div class ='header'>
< img ..... height = 100>
< / div>
< / div>
在萤火虫中,标题div的高度为100,headerWrapper div的高度为0。
图片在它下面的div中可见.... headerWrapper div没有固定的高度。
太混乱了。
感谢 -
Jonathan
当一个子元素浮动并且其父元素不存在时,这会导致父元素collapse到0的高度。
此页面似乎对页面中途的问题有很好的描述。
I'm having trouble getting my divs to vertically expand with their children divs.
I have something like this:
<div class='headerWrapper'>
<div class='header'>
<img..... height=100>
</div>
</div>
In firebug, the header div has a height of 100, the headerWrapper div has a height of 0.
The image is visible in the div beneath it.... There is no fixed height on the headerWrapper div.
So confused.
Thanks- Jonathan
Check and see if you have the header div set to float.
When a child element floats and its parent does not, this causes the parent element to "collapse" to a height of 0.
This page seems to have a pretty good description of the problem about halfway down the page.
这篇关于div是否垂直扩展以适合他们的子div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!