1. 박스 한개 배치해보기

image.png

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <style>
      .outer {
        display: grid;
        justify-content: center;
        align-items: center;
        width: 500px;
        height: 500px;
        border: 2px solid skyblue;
        background-color: aliceblue;
      }

      .inner {
        border: 1px solid red;
        background-color: pink;
        width: 100px;
        height: 100px;
      }
    </style>
  </head>

  <body>
    <div class="outer">
      <div class="inner">안녕</div>
    </div>
  </body>
</html>

2. 박스 2개 배치해보기

image.png

image.png

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <style>
      .outer {
        width: 500px;
        border: 2px solid skyblue;
        background-color: aliceblue;
      }

      .inner {
        border: 1px solid red;
        background-color: pink;
        width: 100px;
        height: 100px;
      }

      .box1 {
        height: 250px;
        display: grid;
        justify-content: end;
      }
      .box2 {
        height: 250px;
        display: grid;
        justify-content: center;
        align-items: end;
      }
    </style>
  </head>

  <body>
    <div class="outer">
      <div class="box1">
        <div class="inner"></div>
      </div>
      <div class="box2">
        <div class="inner"></div>
      </div>
    </div>
  </body>
</html>