2012-07-11 52 views
1

她是我的CSS:是否可以使用百分比在另一个div内的浮动div上设置最小高度?

html { 
/* force document to be 200% of window size */ 
min-height: 200%; 
} 
body { 
height:auto; 
margin:0 auto; 
} 
div#wrapper { 
/* so that child divs with floats stay contained */ 
overflow:hidden; 
margin:auto; 
min-width:200%; 
min-height:200%; /* doesn't work */ 
background-color:#000; 
border:1px solid red; 
} 
div#content1 { 
float:left; 
min-width:45%; 
min-height:45%; /* doesn't work */ 
background-color:#555; 
border:1px solid green; 
} 
div#content2 { 
float:right; 
min-width:45%; 
min-height:45%; /* doesn't work */ 
background-color:#777; 
border:1px solid blue; 
} 

和HTML:

<div id="wrapper"> 
<div id="content1"></div> 
<div id="content2"></div> 
</div> 

我想为#内容1和#conent2始终占据45%的窗口的内容无关。在Firefox中,至少,最小宽度的作品,但最小高度不起作用。在这种情况下是否可以使用百分比设置最小高度?

回答

0

只有在parent容器设置为固定高度时,才能以百分比形式引用height属性。在这种情况下,尽管您明确height:200%html设置为height:auto。因此,将wrapper分隔符设置为百分比高度将不起作用,并且随后的子元素百分比也将无效。

相关问题