2010-06-17 88 views
2

我有這個div的高度設置爲100%,但內容不斷溢出。Css,內容不在邊界

這裏是頁:http://cowgirlsbaking.com/membership

CSS:

#content { 

margin-left: auto; 
margin-right: auto; 
background-color: #FCF6E9; 
width:868px; 
height:100%; 
min-height: 650px; 
-moz-border-radius: 15px; 
-webkit-border-radius: 15px; 
border: 10px solid #EB7CDB; 

回答

4

添加overflow: auto;#content

+0

尼斯,感謝您的幫助。 – Davey 2010-06-17 15:47:21

+0

沒問題。 {:) – 2010-06-17 16:03:12

0

這樣做的原因是你在內容div中有一個浮動元素,並且你不清除浮動元素。

解決這一問題的最好辦法是添加在你的CSS clearfix特定的風格,讓你的容器作爲指定在這裏 http://www.webtoolkit.info/css-clearfix.html

2

這是因爲當你漂浮物,他們不佔用垂直該clearfix類空間在外部元素。

最簡單的辦法是content div的結束前補充一點:

<br style="clear:both"> 

或者使用像.clr { clear: both; }一類<br class="clr">