2013-06-24 34 views
-1

请流体高度来看看这个代码CSS问题100%没有工作

HTML

<div id="wrapper"> 
    <div id="header"> 
     <div id="header_inner"> 

     </div> 
    </div> 

    <div id="contentliquid"> 
     <div id="content"> 
      asdasdasdas 
     </div> 
    </div> 

    <div id="footer"> 
     <div id="footer_inner"> 
     </div> 
    </div> 

</div> 

CSS:

body, html{ 
    margin: 0; 
    padding: 0; 
} 

body { 
    font-family: Verdana, Arial, Helvetica, sans-serif; 
    font-size: 13px; 
    color:#333; 
} 

p { 
    padding: 10px; 
} 

#wrapper { 
    width: 100%; 
    margin: 0 auto; 
} 

#header { 
    float: left; 
    height: 237px; 
    width: 100%; 
} 

#header_inner { 
    float: left; 
    height: 166px; 
    width: 60%; 
    top:30%; 
    position:relative; 
    background: #ff0000; 
} 

#contentliquid { 
    float: left; 
    width: 100%; 
} 

#content { 
    width: 100%; 
    background: #051f3b; 
    height:304px; 
} 

#footer { 
    height: 150px; 
    width: 100%; 
    clear: both; 
} 

#footer_inner { 
    height: 100%; 
    width: 60%; 
    background: #c0db09; 
    clear: both; 
    float:right; 
} 
蓝色

中间部分应该在高度100%,页脚应该在底部。目前中间部分不设置为100%,总之%不工作,而不是像素,即200px等,但我想中间部分是100% http://jsfiddle.net/RyDAw/

+0

您是否希望它具有100%的视口高度或100%的页眉和页脚之间的空间高度,以便页脚始终粘在底部?内容可以比视口长吗? – insertusernamehere

+0

只是想要在每个分辨率为100%的页眉和页脚之间的空间 – user2451541

+0

内容部分100%高度不起作用, – user2451541

回答

-2
CSS 

body, html{ 
margin: 0; 
    padding: 0; 
} 

body { 
    font-family: Verdana, Arial, Helvetica, sans-serif; 
    font-size: 13px; 
    color:#333; 


} 

p { 
    padding: 10px; 
} 

#wrapper { 
    width: 100%; 

    margin: 0 auto; 
} 

#header { 
    float: left; 
    height: 237px; 
    width: 100%; 

} 

#header_inner { 
    float: left; 
    height: 166px; 
    width: 60%; 
    top:30%; 
    position:relative; 
    background: #ff0000; 
} 

#contentliquid { 
    float: left; 
    width: 100%; 

} 

#content { 
    width: 100%; 
    background: #051f3b; 
    min-height:304px; 
    height:100%; 
    position:absolute; 
} 

#footer { 
    height: 150px; 
    width: 100%; 
    clear: both; 

} 

#footer_inner { 
    height: 100%; 
    width: 60%; 
    background: #c0db09; 
    clear: both; 
    float:right;} 
+0

什么也没有... – Nitesh

+0

是,相同的结果:( – user2451541

0

您试图在浮动元素上设置100%的高度。由于浮点元素是“提取”DOM流的,因此无法以%为单位定义它们的大小。尝试从#content_liquid中删除float: left,您应该可以使用%作为高度。

+0

conten_liquid部分现在移动到标题区域 – user2451541

+0

@ user2451541它需要一个明确的:两个...对不起,我忘了告诉。看到这里http://jsfiddle.net/guybrushthreepwood/G5znF/ – Mir

+0

同样的结果,100%不工作。我只是想默认100%身高 – user2451541