min-height
对于父级Div不起作用,因为我将float:left
属性设置为它的子div。最小高度不适用于父级Div
你能帮助我吗?
<style type="text/css">
*{ margin: 0 auto; padding: 0; }
#wrapperd{
width : 500px;
border : 1px solid red;
min-height:200px;
}
#test {
border:2px solid blue;
width:600px;
float:left;
height:500px;
}
</style>
HTML代码
<div id = "wrapperd"> <!-- Parent Div -->
<div id = "test"> </div> <!-- Child Div -->
</div>
演示链接: - http://jsfiddle.net/rushijogle/cFX68/2/
thanx提前:)
您只需[清除您的浮动](http://www.quirksmode.org/css /clearing.html)! – CherryFlavourPez 2013-03-19 17:14:52
一个古老的技巧是将“overflow:hidden;”添加到div。不确定这些缺点。 http://jsfiddle.net/cFX68/5/ – 2013-03-19 17:16:18
赞@CherryFlavourPez说 - '#wrapperd :: after { content:“”; display:block; 明确:均; }' – couzzi 2013-03-19 17:17:02