首页 > 其他 > 详细

9 定位

时间:2020-02-20 14:13:26      阅读:67      评论:0      收藏:0      [点我收藏+]

#1 相对定位

以原来的位置为参考点

<!DOCTYPE html>
<html>
<head>
	<title>定位</title>
	<style type="text/css">
		body{
			border: 1px solid orange;
		}
		div{
			width: 200px;
			height: 200px;
			color:#fff;
		}
		div.one{
			background-color: red;
			position: relative;
			top: 30px;
			left: 100px;
		}
		div.two{
			background-color: green;
			position: relative;
			top: 100px;
		}
		div.three{
			background-color: blue;
		}
	</style>
</head>
<body>
	<!-- position: static
		    1 相对定位 position: relative;
		        不脱离标准文档流,可以调整元素;
		        以原来的位置为参考点
		    2 绝对定位 position: absolute;

              脱离标准文档流;
              不在页面上占位置;
              压盖现象
              根元素页面左上角为参考点
              (子元素绝对定位
              父元素相对定位)

		    3 固定定位 position: fixed;


	 -->
	 <div class="one">one</div>
	 <div class="two">two</div>
	 <div class="three">three</div>

</body>
</html>

#2 绝对定位

层级提高; positon: absolute;

#  小米搜索栏

 

  

9 定位

原文:https://www.cnblogs.com/zhujing666/p/12335405.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!