2023 학원 수업 일지

수업 27일차 - html/css/javascript 5

웨일파도 2023. 4. 11. 11:16
반응형

1교시 : display: grid

<!DOCTYPE html>
<html lang="en">
<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>
        .wrapper {
            display: grid;
            grid-template-columns: repeat(3,1fr);
            grid-template-rows: repeat(3,100px);
        }
        .box {
            padding: 15px;
            color: white;
            text-align: center;
        }
        .box1 {
            background-color: red;
            grid-column: 1/4;
        }
        .box2 {
            background-color: orange;
            grid-row: 2/4;
            grid-column-start: 1;
        }
        .box3 {
            background-color: yellow;
            grid-row-start:2;
            grid-column: 2/4;
        }
        .box4 {
            background-color: green;
            grid-row-start: 3;
            grid-column-start: 3;
        }
       
    </style>
</head>
<body>
    <div class="wrapper">
        <div class="box box1">box1</div>
        <div class="box box2">box2</div>
        <div class="box box3">box3</div>
        <div class="box box4">box4</div>
        <!-- <div class="box box5">box5</div> -->
    </div>
</body>
</html>
  <style>
        .wrapper {
            display: grid;
            grid-template-columns: repeat(3,1fr);
            grid-template-rows: repeat(3,100px);
            grid-template-areas:
            "box1 box1 box1"  
            "box2 box3 box3"
            "box2 . box4"
            ;
        }
        .box {
            padding: 15px;
            color: white;
            text-align: center;
        }
        .box1 {
            background-color: red;
            grid-area: box1;
        }
        .box2 {
            background-color: orange;
            grid-area: box2;
        }
        .box3 {
            background-color: yellow;
            grid-area: box3;
        }
        .box4 {
            background-color: green;
            grid-area: box4;
        }
    </style>
반응형