2012-01-30 86 views
1

我有一個設置爲100%高度的div,它完美呈現,但我有兩個div,不會伸展到100%。這裏的參考是CSS:Div高度沒有完全伸展到100%

#page{ 
    background-color: #4C1B1B; 
    width:85%; 
    height:500px 
    margin:auto; 
    min-height:100%; 

} 

#pageleft{ 
    width:15%; 
    float:left; 
    border:3px solid #B9121B; 
    border-left:0px; 
    padding: 1% 2% 0 2%; 
    -webkit-border-top-right-radius: 50px; 
    -webkit-border-bottom-right-radius: 50px; 
    -moz-border-radius-topright: 50px; 
    -moz-border-radius-bottomright: 50px; 
    border-top-right-radius: 50px; 
    border-bottom-right-radius: 50px; 
    height:100%; 
} 

#pageright{ 
    width:75%; 
    float:right; 
    border:3px solid #B9121B; 
    height:100%; 
    -webkit-border-radius: 25px; 
    -moz-border-radius: 25px; 
    border-radius: 25px; 
    margin:0% 3% 0% 0%; 
} 

在此先感謝。

+2

鏈接很棒,但您應該始終在問題中包含相關的代碼。這樣,如果這些鏈接消失,這個問題仍然有用。 – 2012-01-30 00:48:10

+0

@蒙塔涅你說得對,對不起。 – DonJuma 2012-01-30 01:10:24

回答

2

的問題是在你的CSS:

#page { 
    background-color: #4C1B1B; 
    width:85%; 
    height:500px; <--- this should be 100% 
    margin:auto; 
    min-height:100%; 
} 

你父div的高度設置爲500px。所以你的元素是100%。將其更改爲height: 100%

+0

換句話說,你需要將'html'和'body'的高度設置爲'100%'。 – Wex 2012-01-30 01:02:32

+0

@Wex不,他已經設置了html和body的高度。他需要將'#page'的高度設置爲100px而不是500px。 – 2012-01-30 01:03:17

+0

謝謝,我不敢相信我在調試時沒有看到。 – DonJuma 2012-01-30 01:11:39