2012-01-30 85 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