absolute如果不追加relative其上边框距离 body 元素为 15 px 距离

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>absolute距离</title>
<style>
div.parent { width:100px; height:70px; border:1px solid blue; }
div.child { width:80px; height:30px; border:1px solid black; background-color:silver; }
</style>
</head>
<body>
<div class="parent">
<div class="child">1</div>
<div class="child" style="position:absolute;top:15px;">2</div>
</div>
</body>
</html>

posted on 2016-04-06 13:23  David1314  阅读(188)  评论(0编辑  收藏  举报

导航