艱難的在你的問題,我只想用固定 定位頁眉和頁腳,然後簡單 水平含量格..見fiddle我製作
THE HTML
<div id="header">Header</div>
<div id="content">Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content Content </div>
<div id="footer">Footer</div>
的CSS
*{
padding:0;
margin:0;
}
html{
overflow-y:hidden;
}
#header,#footer {
width:100%;
position:fixed;
height:50px;
left:0;
background:#404040;
z-index:9999;
}
#header{top:0;}
#footer{bottom:0;}
#content{
position:absolute;
background:gray;
top:50px;
left:0;
min-width:100%;
bottom:50px;
float:left;
display:block;
width:5000px; /*your content width but 5000 for testing*/
}
如果你想頁眉和頁腳規模,你可以使用this fiddle
CSS3的方式
您可以使用該新的CSS3屬性Flexbox的:
參見以下鏈接瞭解Flexbox的一個Example
更多信息:Tutsplus
Flex的盒子是什麼會做的伎倆
但是在IE9中不支持 ...
艱難的所有新的瀏覽器將它含IE10:
caniuse
這不考慮任何的調整大小的限制。我已經想通了,但調整大小是使它變得棘手的,因爲頁眉和頁腳需要根據內容來調整大小。 – 2013-03-07 07:38:09