CSS中的绝对定位

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>绝对定位</title>
		<style type="text/css">
			#mydiv {
				background-color: cadetblue;
				border: medium red solid;
				width: 100px;
				height: 100px;
				/*绝对定位*/
				position: absolute;
				/*离左边100px;离顶部100px*/
				left : 100px;
				top : 100px;
			}
			#yourdiv {
				background-color : bisque;
				border: medium blue solid;
				width: 100px;
				height: 100px;
				position: absolute;
				left : 50px;
				top : 50px;
			}
		</style>
    </head>
	<body>
		<div id="mydiv"></div>
		<div id="yourdiv"></div>
	</body>
</html>

在这里插入图片描述

posted @ 2020-08-17 22:49  YU_UY  阅读(166)  评论(0编辑  收藏  举报