html & css/개념

flex - holy grail layout

Doo Hee 2023. 11. 24. 23:28

holy grail (성배) Layout

아래와 같은 레이아웃을 holy grail 레이아웃이라고 한다.

- 성배를 찾는 것과 같은 노력을 해서 지어진 이름

 

<코드>

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <style>
      .container {
        display: flex;
        flex-direction: column;
      }

      header {
        border-bottom: 1px solid gray;
        padding-left: 20px;
      }

      footer {
        border-top: 1px solid gray;
        padding: 20px;
        text-align: center;
      }

      .content {
        display: flex;
        flex-direction: row;
      }

      .content nav {
        border-right: 1px solid gray;
      }

      .content aside {
        border-left: 1px solid gray;
      }

      nav,
      aside {
        flex-basis: 150px;
        flex-shrink: 0;
      }

      main {
        padding: 10px;
      }
    </style>
  </head>
  <body>
    <div class="container">
      <header>
        <h1>생활코딩</h1>
      </header>
      <section class="content">
        <nav>
          <ul>
            <li>html</li>
            <li>css</li>
            <li>javascript</li>
          </ul>
        </nav>
        <main>생활코딩은 일반인을 위한 코딩 수업입니다.</main>
        <aside>AD</aside>
      </section>
      <footer><a href="https://www.naver.com">홈페이지</a></footer>
    </div>
  </body>
</html>