css-布局定位

mac2022-06-30  8

  position: 

  ** 属性值   - absolute:     *** 将对象从文档流中拖出     *** 可以是top、bottom等属性进行定位   - relative:     *** 不会将对象从文档流中拖出     *** 可以是top、bottom等属性进行定位

<html> <head> <title>World</title> <style type="text/css"> div { border:2px solid blue; width:200px; height:100px; } #div11 { background-color:red; position:absolute; /* left:500px; top:100px; */ } #div12 { background-color:green; width:250px; height:100px; } #div13 { background-color:blue; } </style> </head> <body> <div id="div11">AAAAAAAAAAA</div> <div id="div12">BBBBBBBBBBB</div> <div id="div13">CCCCCCCCCCC</div> </body> </html>

 

<html> <head> <title>World</title> <style type="text/css"> div { border:2px solid blue; width:200px; height:100px; } #div11 { background-color:red; position:relative; left:500px; top:100px; } #div12 { background-color:green; width:250px; height:100px; } #div13 { background-color:blue; } </style> </head> <body> <div id="div11">AAAAAAAAAAA</div> <div id="div12">BBBBBBBBBBB</div> <div id="div13">CCCCCCCCCCC</div> </body> </html>

 

转载于:https://www.cnblogs.com/ibabyli/p/9888776.html

最新回复(0)