自创理解绝对定位和相对定位的方法

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .test::after {
            content: "heeeee";
            position: absolute;
            display: block;
            background-color: blue;
        }
        
        .test::before {
            content: "kkkkk777777777777777";
            display: block;
            position: absolute;
            background-color: red;
        }
        
        .test {
            background-color: pink;
            position: relative;
        }
    </style>
</head>

<body>
    <div class="test">
        one
    </div>
</body>

</html>

 

posted @ 2020-04-27 21:14  zhustarstar  阅读(145)  评论(0编辑  收藏  举报