2014-01-16 14 views
-1

我用下面的样式表:如何扩大包装时,内容更(与CSS)

html, body 
{ 
    height: 100%; 
} 
.wrapper 
{ 
    min-height: 100%; 
    margin: auto; 
    background: #fffcfc; 
    width: 840px; 
    padding:5px; 
    box-shadow: 0px 0px 10px #888888; 
} 
.content 
{ 
    width:670px; 
    float:right; 
    padding:5px; 
    border:solid 1px; 
} 
.left 
{ 
    width:160px; 
    float:left; 
    vertical-align:top; 
} 
.footer 
{ 
    height: 40px; 
    background:#33559b; 
    text-align:center; 
    color: #ebe4e4; 
    padding:10px; 
    font-size:10pt; 
    margin-top:10px; 
clear: both; 
} 

问题是,当在内容记录较多,内容是扩大,但包装不扩张,它已经固定高度。内容多时如何扩展包装?

输出:

enter image description here

+1

您可能需要共享HTML标记......我想你并没有清除内容的“浮动” – DaniP

+0

这样的东西? [DEMO](http://jsfiddle.net/Ruddy/nwX85/) – Ruddy

回答

2

将这个CSS在样式表:

.clear { clear: both; } 

然后把一个明确的div只是你的包装div的结束标记之前。

<div class="wrapper"> 
Your content 
<div class="clear"></div> 
</div> 
+0

从来没有像@Era – Nilesh

+0

+1的天才+1:明显的原因;) – NoobEditor

+0

@Era,非常好 –