DIV(CSS 定位)
阿新 • • 發佈:2017-11-05
下層 style position ack span 上層 order col blog
<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 定位)