CSS입문

CSS_position(stack order_실습)_22.04.12(Tue)

양빵빵 2022. 4. 12. 18:15

 

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

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .container {
            margin: 50px auto;
            width: 600px;
           
        }

        .box {
            width: 100px;
            height: 100px;
            background: tomato;
            border: 4px dashed red;
            border-radius: 15px;
            text-align: center;
            line-height: 100px;
            float:left;
            margin-right: -30px;
            position: relative;
        }
        .clearfix::after {
            content:'';
            display: block;
            clear:both;
           
        }

        .box:hover {
            background: greenyellow;
            border: 4px dashed green;
            z-index: 100;
        }


    </style>

</head>

<body>
    <div class="container clearfix">
        <div class="box box1">1</div>
        <div class="box box2">2</div>
        <div class="box box3">3</div>
        <div class="box box4">4</div>
        <div class="box box5">5</div>
    </div>
</body>

</html>