码迷,mamicode.com
首页 > Web开发 > 详细

DIV(CSS 定位)

时间:2017-11-05 11:24:30      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:back   absolute   position   height   border   ack   col   relative   ati   

<div style="position: relative;width:800px;height: 300px;background-color: gainsboro;border:1px solid red;margin: 0 auto">
    <div style="position: absolute;width:100px;height: 100px;bottom: 0;left: 0;background-color: brown">
    </div>
</div>


<div style="position: relative;width:800px;height: 300px;background-color: gainsboro;border:1px solid red;margin: 0 auto">
    <div style="position: absolute;width:100px;height: 100px;top: 0;right: 0;background-color: brown">
    </div>
</div>


<div style="position: relative;width:800px;height: 300px;background-color: gainsboro;border:1px solid red;margin: 0 auto">
    <div style="position: absolute;width:100px;height: 100px;bottom:0;background-color: brown">
    </div>
</div>

当需要下层DIV在上层DIV中定位时,上层DIV使用relative,下层DIV使用absolute.配合TOP,LEFT,RIGHT,BOTTOM定位。

DIV(CSS 定位)

标签:back   absolute   position   height   border   ack   col   relative   ati   

原文地址:http://www.cnblogs.com/GabyGU/p/7786861.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!