css绝对定位代码

  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
.style1 { position:relative;
height:150px; 150px;
border:1px solid #000;
background-color:#a2d39c;
}
.style2 { position:absolute;
left:30px; top:30px;
height:50px; 50px;
border:1px solid black;
margin-bottom:10px;
background-color:#FF0000;}
.style3 { border:1px solid black;
height:50px; 50px;
background-color:#00FF00;}
</style>
</head>

<body>
<div class="style1">
<div class="style2"> 一个</div>
<div class="style3">2个</div>
</div>
</body>
</html>

原文地址:https://www.cnblogs.com/liuzhuqing/p/7481164.html