20 相对定位练习

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>相对定位</title>
    <style>
        #box{
            height: 300px;
            width: 300px;
            padding: 20px;
            border: #32c735 3px solid;
        }
        a{
            width: 100px;
            height:100px;
            line-height: 100px;
            text-align: center;
            display: block;
            background: #a2148f;
            text-decoration: none;
        }
        a:hover{
            background: orange;
        }
        .a2,.a4{
            position: relative;
            left: 200px;
            bottom: 100px;
        }
        .a5{
            position: relative;
            left: 100px;
            bottom: 300px;
        }
    </style>
</head>
<body>
<div id="box">
    <a class="a1" href="">链接1</a>
    <a class="a2" href="">链接2</a>
    <a class="a3" href="">链接3</a>
    <a class="a4" href="">链接4</a>
    <a class="a5" href="">链接5</a>
</div>
</body>
</html>
posted @ 2023-09-20 10:55  被占用的小海海  阅读(3)  评论(0编辑  收藏  举报