实例
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>4.浮动元素也支持相对定位</title> <style type="text/css"> .box1 { width: 200px; height: 200px; background-color: red; float: left; } .box2 { width: 200px; height: 200px; background-color: coral; float: left; position: relative; top:100px; left: -100px; } .box3 { width: 200px; height: 200px; background-color: brown; float: left; position: relative; left: -200px; top: 200px; } </style> </head> <body> <div class="box1"></div> <div class="box2"></div> <div class="box3"></div> </body> </html>
运行实例 »
点击 "运行实例" 按钮查看在线实例