基于标准,实现底部对齐

基于标准,实现底部对齐

很多人在以往的页面制作中用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 >

你可能感兴趣的:(基于标准,实现底部对齐)