html css中的position的运用

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>position</title>

    <style>

        .parent {
            position: relative;
            width: 210px;
            height: 250px;
            background-color: yellow
        }

        div {
            width: 200px;
            height: 200px;
        }

        #relative {
            background-color: red;
            position: absolute;
            left:10px;
            top:10px;
            z-index: 1;
        }

        .general {
            background-color: grey;
            width: 100%;
            height: 220px;
        }

        #absoulte {
           background-color: red;
           position: relative;
           left:10px;
           top:10px;
       } 
    </style>
</head>
<body>
    <div class="parent">
        <div id="relative">
            relative相对于自己原来的位置偏移 left:10px;top:10px;不占位
        </div>
        <div class="general"></div>
    </div>
    <hr>
     <div class="parent">
        <div id="absoulte">
            absoulte以父层做为定位基线的话,在父层应用absolute或relativ属性就可以,left:10px;top:10px;占位
        </div>
        <div class="general"></div>
    </div>

</body>
</html>

演示地址
http://xhope.top/samples/html/position.html