<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>定位</title>
<!--位置:相对:
绝对:以父容器左上角为原点,向右、向下为正坐标
-->
<style type="text/css">
*{
margin: 0px;
padding: 0px;
}
div{
position: absolute;
left: 50px;
top: 70px;
width: 200px;
height: 200px;
border: 1px dotted red;
background-color: yellow;
}
p{
position: absolute;
left: 20px;
top: 50px;
}
</style>
</head>
<body>
<!--<div></div>-->
<div>
<p>你好</p>
</div>
</body>
</html>
HTML5绝对位置
最新推荐文章于 2024-10-17 18:55:09 发布