实例
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>绝对定位</title> <style type="text/css"> .div11{ position: relative;} .div1{width: 100px;height: 100px;background-color: #ffff0a;position: absolute;left: 100px;} .div2{width: 100px;height: 100px;background-color: royalblue;position: absolute; top: 100px;} .div3{width: 100px;height: 100px;background-color: rosybrown;position: absolute;top:100px;left: 200px;} .div4{width: 100px;height: 100px;background-color: burlywood;position:absolute;top:200px;left: 100px;} </style> </head> <body> <div class="div11"> <div class="div1"></div> <div class="div2"></div> <div class="div3"></div> <div class="div4"></div> </div> </body> </html>
运行实例 »
点击 "运行实例" 按钮查看在线实例