<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>position的属性</title>
<style type="text/css">
div {
margin:10px;
padding:5px;
font-size:12px;
line-height:25px;
}
#father {
border:1px #666 solid;
margin:10px;
position:relative;
}
#first {
background-color:#FC9;
border:1px #B55A00 dashed;
/*position:fixed;*/
top:10px;
left:10px;
}
#second {
position:absolute;
top:20px;
right:20px;
background-color:#CCF;
border:1px #0000A8 dashed;
}
#third{
position:relative;
top:-15px;
background-color:#09C;
border:1px #606 dashed;
}
</style>
</head>
<body>
<div id="father">
<div id="first">第一个盒子</div>
<div id="second">第二个盒子</div>
<div id="third">第三个盒子</div>
</div>
</body>
</html>
相对 与 绝对
最新推荐文章于 2022-05-19 23:21:32 发布