基於標準,實現底部對齊

很多人在以往的頁面製作中用valign:bottom實現底部對齊。

但是在xHTML中,CSS中沒有了這個就不知道如何是好,以下爲解決方法:

css:

#box1 { 
position 
: relative ; 
background 
: red ; 
height 
: 100px ; 
width 
: 100px ; 
}
 
#box2 
{ 
position 
: absolute ; 
background 
: #BBB ; 
height 
: 20% ; 
width 
: 100% ; 
left 
: 0 ; 
bottom 
: 0 ; 
}
 

html:

<div id="box1">
  
<div id="box2">在下邊了</div>
</div>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章