Jez*_*mas 78
您正在寻找的是CSS Sticky Footer.
* {
margin: 0;
padding: 0;
}
html,
body {
height: 100%;
}
#wrap {
min-height: 100%;
}
#main {
overflow: auto;
padding-bottom: 180px;
/* must be same height as the footer */
}
#footer {
position: relative;
margin-top: -180px;
/* negative value of footer height */
height: 180px;
clear: both;
background-color: red;
}
/* Opera Fix thanks to Maleika (Kohoutec) */
body:before {
content: "";
height: 100%;
float: left;
width: 0;
margin-top: -32767px;
/* thank you Erik J - negate effect of float*/
}Run Code Online (Sandbox Code Playgroud)
<div id="wrap">
<div id="main"></div>
</div>
<div id="footer"></div>Run Code Online (Sandbox Code Playgroud)
Cha*_*ala 27
你可以position:fixed;用来bottom.
例如:
#footer{
position:fixed;
bottom:0;
left:0;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
258550 次 |
| 最近记录: |