2013-03-12 144 views
0

一直试图解决这个问题约一个小时,现在越来越令人沮丧。填充DIV高度

所以我需要我的div来填充页脚的其余部分。

http://gyazo.com/999cce47ea567878586fbc4c843f80fc

设置高度为100%的股利不增加尺寸的。

.body-middle { 
    width: 979px; 
    margin: 0 auto; 
    bottom:0; 
    height:100%; 
    padding-bottom: 50px; 
} 
footer { 
    height: 50px; 
    width: 100%; 
    text-align: center; 
    position: absolute; 
    bottom: 0; 
    background-color:#ebebeb; 
} 

他们都在一个div称为页面

.page { 
    min-height: 100%; 
    position:relative; 
} 
+0

我已经做了,没有任何改变。 – Jedigasm 2013-03-12 14:46:43

+0

如果你不打扰旧版浏览器,你可以将它添加到你的'.body-middle' - 'box-sizing:border-box;' – Pete 2013-03-12 14:58:46

+0

没有改变任何东西。 – Jedigasm 2013-03-12 15:09:29

回答

0

试着给你的身体元素width:100%了。

+0

它已经做到了。 – Jedigasm 2013-03-12 15:10:14

0

为了占据屏幕的整个高度,您必须将height:100%添加到htmlbody标签。

http://jsfiddle.net/WtAg7/1/

PS:除非有使用这些类名(。第,。体中等),你应该使用其他的div ID的替代,这将通过更换.前缀来连接到CSS前缀为#

+0

它已经是...... – Jedigasm 2013-03-12 15:43:56

0

将身体和身高造型设置为100%,然后将您的身高设置为100%。

CSS

body { height: 100%; margin: 0px; padding: 0px; } 
html { height: 100%; } 
.container { height: 100%;} 

HTML

<body> 
<div class="container"> 
<span>Something</span> 
</div> 
</body>