2010-05-15 58 views
1

你怎麼會做這樣的: http://matthewjamestaylor.com/blog/keeping-footers-at-the-bottom-of-the-pageCSS:流體佈局 - 頁腳始終在底部,和流體中心

除了與流體中心(垂直拉伸,身高100%)?

+0

http://matthewjamestaylor.com/blog/bottom-footer-demo.htm爲演示 – 2010-05-15 08:24:44

+0

你能更好的描述你想要什麼呢?流體中心水平和垂直?垂直拉伸到內容的底部?什麼高度100%? – mVChr 2010-05-19 19:20:14

+0

我想在頁面中間的DIV允許使用寬度的一些元素:100% – 2010-05-23 04:36:30

回答

1

我會使用一個display:table;佈局爲身體或包裝,並給中間行百分之百的高度。

像this.-

<body> 
<div> 
    <div id=head">head</div> 
</div> 
<div> 
    <div id=body">body</div> 
</div> 
<div id=head"> 
    <div id="foot">foot</div> 
</div> 
</body> 

用下面的CSS。

html, body 
{ 
    height:100%; 
} 
body 
{ 
    width:100%; 
    display:table; 
} 
body > div 
{ 
    display:table-row; 
} 
body > div > div 
{ 
    display:table-cell; 
} 
#body 
{ 
    height:100%; 
}