footer貼在底部的佈局

http://www.cssstickyfooter.com/

這個網頁即使內容很少的情況下,它也始終在頁面的底部。否則頁面底部將留下大量空白。
footer位置自適應

 

<div id="wrap">
<div id="main" class="clearfix">
<div id="content">
ccc
</div>
<div id="side">
sss
</div>
</div>
</div>
<div id="footer">
fff
</div>

 

html, body, #wrap {height: 100%;}
body > #wrap 
{height: auto; min-height: 100%;}
#main 
{padding-bottom: 150px;}  /* 必須使用和footer相同的高度 */
#footer 
{position: relative;
margin-top
: -150px; /* footer高度的負值 */
height
: 150px;
background
: #ddd;
clear
: both;}

.clearfix:after 
{content: ".";
display
: block;
height
: 0;
clear
: both;
visibility
: hidden;}
.clearfix 
{display: inline-block;}
/* Hides from IE-mac \*/
* html .clearfix 
{height: 1%;}
.clearfix 
{display: block;}
/* End hide from IE-mac */

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章