μλ―Έμλ κ°νμ μν
<br>
μ¬μ©
- κ°λ°μλ§λ€ μκ²¬μ΄ λ€λ₯΄λ€.
- μ견 1 : λ¨μν λμμΈμ μν
<br>
μ¬μ©μ μ§μνλ€.- μ견 2 : μλ―Έμλ κ°νμ μν κ²μ΄λΌλ©΄ μλ―Έμλ νκ·Έλ₯Ό μ¬μ©ν΄λ 무방νλ€.
λμ¦λ νλ¬μ€ ννμ΄μ§ ꡬ경νκΈ°
flex
λ‘ κ΅¬ν- μΈκ΅ κΈ°μ μ
float
보λ€flex
λ₯Ό λ λ§μ΄ μ¬μ©νλμ?
=> νμΈ νμ!
=> μΈκ΅ κΈ°μ μ λ²μ μμ λλ¬Έμfloat
μ μ¬μ©ν κ²½μ°, λμ΄ κ°μ΄λ ν μ€νΈ κΈΈμ΄ λ± λ€λ₯Έ μΈμ΄λ‘ λ³κ²½ μ UIκ° κΉ¨μ§κΈ° μ¬μΈ κ² κ°μμflex
λ₯Ό λ§μ΄ μ¬μ©ν κ² κ°λ€λ μκ²¬μ΄ μμλ€.
μ°Έκ³ λ§ν¬
Holy Grail Layout
μ ꡬννκΈ° μν΄ λ§μ μ¬λμ΄ λ
Έλ ₯νμ§λ§ μλ²½ν κ²°κ³Όλ₯Ό μ°ΎκΈ° λͺ»νλ€λ λΉμ flex
λ₯Ό μ΄μ©ν Holy Grail Layout<!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>Holy Grail</title>
<link
href="https://fonts.googleapis.com/css2?family=Material+Icons+Outlined"
rel="stylesheet"
/>
<link rel="stylesheet" href="../reset.css" />
<link rel="stylesheet" href="012.css" />
</head>
<body>
<header>
<h2 class="area-name">header</h2>
<a href="#" class="logo">LOGO</a>
<nav>
<ul class="menu">
<li><a href="#" class="link-menu">MENU1</a></li>
<li><a href="#" class="link-menu">MENU2</a></li>
<li><a href="#" class="link-menu">MENU3</a></li>
<li><a href="#" class="link-menu">MENU4</a></li>
</ul>
</nav>
<button class="btn-toggle">
<span class="material-icons-outlined"> menu </span>
</button>
</header>
<main>
<section>
<h2 class="area-name">section</h2>
<article><h2 class="area-name">article</h2></article>
<article><h2 class="area-name">article</h2></article>
<article><h2 class="area-name">article</h2></article>
</section>
<aside>
<h2 class="area-name">aside</h2>
</aside>
</main>
<footer>
<h2 class="area-name">footer</h2>
</footer>
</body>
</html>
@charset "utf-8";
body {
display: flex;
flex-direction: column;
}
header,
section,
aside,
footer {
position: relative;
padding: 30px 0;
}
.area-name {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
color: rgba(0, 0, 0, 0.5);
font-size: 40px;
font-weight: bold;
}
/* header */
header {
display: flex;
align-items: center;
justify-content: space-between;
background-color: khaki;
}
.logo {
padding: 0 30px;
font-size: 20px;
font-weight: bold;
}
.menu {
display: flex;
padding-right: 20px;
}
.menu li {
margin-left: 10px;
}
.menu .link-menu {
padding: 5px 15px;
border-radius: 30px;
background-color: rgba(255, 255, 255, 0.6);
font-weight: bold;
}
.btn-toggle {
display: none;
margin-right: 30px;
padding: 10px 10px 8px;
border: 0;
background: none;
}
/* main */
main {
display: flex;
flex-wrap: wrap;
min-height: 500px;
}
/* main > section */
section {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
flex: 4;
padding: 30px;
background-color: lemonchiffon;
}
article {
position: relative;
width: 48%;
background-color: lightgreen;
}
article:nth-of-type(1) {
width: 100%;
}
article + article {
margin-top: 4%;
}
/* main > aside */
aside {
flex: 1;
background-color: lavender;
}
/* footer */
footer {
min-height: 50px;
background-color: lightcoral;
}
@media screen and (max-width: 800px) {
.menu {
display: none;
}
.btn-toggle {
display: block;
}
main {
flex-direction: column;
}
section {
flex: 1;
}
aside {
flex: 1;
}
}
μ νμ§κ° μκ²Όλ€μ!! λ무 κ·μ¬μμ¬γ γ γ γ