Basiclly我是儘量讓我的頭固定在頁面的頂部,並在同一時間,我還需要我的頁腳必須在頁面底部,whethere有是更少或更多的內容。但我不想要我的頁腳定位。所以,當數據頁腳移動到那個位置時,會有很大的變化。我現在使用的代碼是workin很好,如果我不做我的頭修復。頁眉在始終頂頁腳底部
<body>
<div id="header">header</div>
<div id="content">content</div>
<div id="footer">footer</div>
</body>
CSS因爲這是
*{ margin:0px; padding:0px;}
html{
margin:0;
padding:0;
height:100%;
}
body {
min-height:100%;
position:relative;
}
#header {
padding:10px;
background:#5ee;
}
#content {
padding:10px;
padding-bottom:80px; /* Height of the footer element */
}
#footer {
width:100%;
height:80px;
position:absolute;
bottom:0;
left:0;
background:#ee5;
}
這是代碼,我沒有固定我的頭在這一點,但我需要一些幫助將其固定。
更換你的角色.... #內容{ 填充:10px的; padding-bottom:80px;/*頁腳元件的高度*/\t \t 最小高度:700像素; } #footer的{ 寬度:100%; height:80px; 位置:相對; 背景:#ee5; } – hayat 2013-04-24 14:48:12