2010-02-19 174 views
2

假設我有2個DIV,一個在另一個之上。垂直對齊DIV

如何對齊頂部一個頂部的文字,並調整底部一個底部的文字?

回答

2

真 - 垂直對齊只有當你設置每個div的displaytable-cell

工作
div#top, div#bottom { display: table-cell } 
div#top { vertical-align: top } 
div#bottom { vertical-align: bottom } 
+0

請注意,表格單元不支持IE7和:(:(http://www.quirksmode.org/css/display.html獲取更多信息) – Owen 2010-02-19 05:35:09

+0

Webkit在瀏覽器中如何? – TIMEX 2010-02-19 07:24:28