2010-02-19 239 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