position属性
使用情况:
1.块级元素相对于浏览器的位置
——只需要设置块级元素本身的 position:abosolute,并设置其top、left等属性
<style>
#father {border:1px #cccccc solid; width:200px; height:300px; }
#son {border-top:1px #FF5809 solid; background:#f2f6fb; width:100%; height:30px; position:absolute; bottom:30px; left:0px; }
</style>
2.块级元素相对于其父级元素的位置
——需要设置父级元素的position:relative,块级元素本身的 position:abosolute,并设置其top、left等属性
<style>
#father {border:1px #cccccc solid; width:200px; height:300px; position:relative; }
#son {border-top:1px #FF5809 solid; background:#f2f6fb; width:100%; height:30px; position:absolute; bottom:30px; left:0px; }
</style>