html, body {
height: 100%;
background-color: #678dae;
margin: 0px;
padding: 0px;
}
#wrap {
min-height: 100%;
}
#main {
width: 70%;
/* I need them to be centered like this because my div is being resized from time to time */
margin-left: auto;
margin-right: auto;
overflow:auto;
padding-bottom: 150px;
background-color: #fff;
}
#footer {position: relative;
margin-top: -150px; /* negative value of footer height */
height: 150px;
background-color: #333;
clear:both;
}

<div id="wrap">
<div id="main">
<div id="content">
<p>Div content</p>
<!-- <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> -->
</div>
</div>
</div>
<div id="footer">
<p>Footer content</p>
</div>
&#13;
答案 0 :(得分:0)
请试试这个:
#footer {
background-color: #333;
bottom: 0;
height: 150px;
position: absolute;
width: 100%;
}
答案 1 :(得分:0)
html, body {
height: 100%;
background-color: #678dae;
margin: 0px;
padding: 0px;
}
#wrap {
min-height: 100%;
}
#main {
width: 70%;
/* I need them to be centered like this because my div is being resized from time to time */
margin-left: auto;
margin-right: auto;
overflow:auto;
padding-bottom: 150px;
background-color: #fff;
}
#footer {
position: fixed;
margin-top: -150px; /* negative value of footer height */
height: 25px;
background-color: #333;
bottom:0;
width:100%;
}
&#13;
<div id="wrap">
<div id="main">
<div id="content">
<p>Div content</p>
<!-- <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> -->
</div>
</div>
</div>
<div id="footer">
<p>Footer content</p>
</div>
&#13;
我更改了一些页脚属性
答案 2 :(得分:0)
height: inherit;
可能有所帮助..这通常有助于身高方面...