
Flex(ν λ°©ν₯ λ μ΄μμ)μ μ μ¬νGridλ λ λ°©ν₯(κ°λ‘-μΈλ‘) λ μ΄μμ λ©μλμ΄λ€. λ°λΌμFlexλ³΄λ€ λ 볡ν©μ μΈ λ μ΄μμ ννμ΄ κ°λ₯νλ€!GridλFlexμ λ§μ°¬κ°μ§λ‘containerμitemλ§ μμΌλ©΄ λλ©°containerμ μ μ©νλμμ±,itemμ μ μ©νλ μμ±μΌλ‘ λλμ΄μ§λ€.. λνGridλcontainerμdisplay: grid;λ₯Ό μ€μ νλ κ²μΌλ‘λΆν° μμλλ€.
.container {
display: grid;
}



그리λ 컨ν μ΄λ (Grid Container)
display: gridλ₯Ό μ μ©νλGridμ μ 체 μμ
그리λ μμ΄ν (GridΒ Item)
Grid컨ν μ΄λμ μμ μμ. μ΄itemλ€μ΄Gridκ·μΉμ μν΄ λ°°μΉλλ€.
그리λ νΈλ (Grid Track)
Gridμ ν(Row) λλ μ΄(Column)
그리λ μ (Grid Cell)
Gridμ ν μΉΈ.<div>κ°μ μ€μ htmlμμλ 그리λ μμ΄ν μ΄κ³ , μ΄λ°Gridμμ΄ν νλκ° λ€μ΄κ°λ βκ°μμ μΉΈ(ν)βμ΄λΌκ³ μκ°νλ©΄ λλ€.
그리λ λΌμΈ(Grid Line)
Gridμ μ ꡬλΆνλ μ
그리λ λ²νΈ(Grid Number)
GridλΌμΈμ κ° λ²νΈ
그리λ κ°(Grid Gap)
Gridμ μ¬μ΄μ κ°κ²©
그리λ μμ(Grid Area)
GridλΌμΈμΌλ‘ λλ¬μΈμΈ μ¬κ°ν μμ, 그리λ μ μ μ§ν©
display: grid;gridλ‘ μ¬μ©νκ² λ€κ³ μ€μ .container {
display: grid;
/* display: inline-grid; */
}
/* κ·Έλ¦¬κ³ μ무 μΌλ μΌμ΄λμ§ μμλ€ */
grid-template-rows / grid-template-columns 그리λ νν μ μgrid νΈλμ ν¬κΈ°λ€μ μ§μ ν΄μ£Όλ μμ±repeatν¨μλ repeat(λ°λ³΅νμ, λ°λ³΅κ°)μΌλ‘ λ°λ³΅λλ κ°μ μλμΌλ‘ μ²λ¦¬νλ€.minimaxν¨μλ μ΅μκ°κ³Ό μ΅λκ°μ μ§μ ν μ μλ ν¨μμ΄λ€.auto-fillμ columnμ κ°μλ₯Ό 미리 μ νμ§ μκ³ , μ€μ λ λλΉκ° νμ©νλ ν μ΅λν μ
μ μ±μ΄λ€. auto-fitμ λ¨λ 곡κ°μ μ±μ΄λ€..container {
grid-template-columns: 200px 200px 500px;
/* grid-template-columns: 1fr 1fr 1fr */
/* grid-template-columns: repeat(3, 1fr) */
/* grid-template-columns: 200px 1fr */
/* grid-template-columns: 100px 200px auto */
grid-template-rows: 200px 200px 500px;
/* grid-template-rows: 1fr 1fr 1fr */
/* grid-template-rows: repeat(3, 1fr) */
/* grid-template-rows: 200px 1fr */
/* grid-template-rows: 100px 200px auto */
}
row-gap/column-gap/ gap κ°κ²© λ§λ€κΈ°.container {
row-gap: 10px;
/* rowμ κ°κ²©μ 10pxλ‘ */
column-gap: 20px;
/* columnμ κ°κ²©μ 20pxλ‘ */
}
.container {
gap: 10px 20px;
/* row-gap: 10px; column-gap: 20px; */
}
.container {
gap: 20px;
/* row-gap: 20px; column-gap: 20px; */
}
grid-auto-column/grid-auto-rows 그리λμ ννλ₯Ό μλμΌλ‘ μ μgrid-template-columns(λλ grid-template-rows)μ ν΅μ λ₯Ό λ²μ΄λ μμΉμ μλ νΈλμ ν¬κΈ°λ₯Ό μ§μ νλ μμ±.container {
grid-template-rows: repeat(3, minmax(100px, auto));
}
align-items μΈλ‘ λ°©ν₯ μ λ ¬columnμΆ) λ°©ν₯μΌλ‘ μ λ ¬νλ€..container {
align-items: stretch;
/* align-items: start; */
/* align-items: center; */
/* align-items: end; */
}
justify-items κ°λ‘ λ°©ν₯ μ λ ¬rowμΆ) λ°©ν₯μΌλ‘ μ λ ¬νλ€..container {
justify-items: stretch;
/* justify-items: start; */
/* justify-items: center; */
/* justify-items: end; */
}
place-itemsalign-itemsμ justify-itemsλ₯Ό κ°μ΄ μΈ μ μλ λ¨μΆ μμ±μ΄λ€..container {
place-items: center start;
}
align-content μμ΄ν
κ·Έλ£Ή μΈλ‘ μ λ ¬Gridμμ΄ν
λ€μ λμ΄λ₯Ό λͺ¨λ ν©ν κ°μ΄ Grid컨ν
μ΄λμ λμ΄λ³΄λ€ μμ λ Gridμμ΄ν
λ€μ ν΅μ§Έλ‘ μ λ ¬νλ€..container {
align-content: stretch;
/* align-content: start; */
/* align-content: center; */
/* align-content: end; */
/* align-content: space-between; */
/* align-content: space-around; */
/* align-content: space-evenly; */
}
justify-content μμ΄ν
κ·Έλ£Ή κ°λ‘ μ λ ¬Gridμμ΄ν
λ€μ λλΉλ₯Ό λͺ¨λ ν©ν κ°μ΄ Grid컨ν
μ΄λμ λμ΄λ³΄λ€ μμ λ Gridμμ΄ν
λ€μ ν΅μ§Έλ‘ μ λ ¬νλ€..container {
justify-content: stretch;
/* justify-content: start; */
/* justify-content: center; */
/* justify-content: end; */
/* justify-content: space-between; */
/* justify-content: space-around; */
/* justify-content: space-evenly; */
}
place-contentalign-contentμ justify-contentλ₯Ό κ°μ΄ μΈ μ μλ λ¨μΆ μμ±μ΄λ€..container {
place-content: space-between center;
}
grid-column/grid-row κ° μ
μ μμ μ§μ 
columnκ³Ό rowμ λ²μλ₯Ό κ²°μ νλ€. λΉ¨κ°μ μμμ μ½λλ‘ μ°λ©΄ μλμ κ°λ€..item:nth-child(1) {
grid-column-start: 1;
grid-column-end: 3;
grid-row-start: 1;
grid-row-end: 2;
}
.item:nth-child(1) {
grid-column: 1 / 3;
grid-row: 1 / 2;
}

.item:nth-child(1) {
/* 1λ² λΌμΈμμ 2μΉΈ */
grid-column: 1 / span 2;
/* 1λ² λΌμΈμμ 3μΉΈ */
grid-row: 1 / span 3;
}

grid-template-areas μμ΄ μ΄λ¦μΌλ‘ 그리λ μ μnoneμμ¬μ©νλ€..container {
grid-template-areas:
"header header header"
" a main b "
" . . . "
"footer footer footer";
}

grid-areas μμ μ΄λ¦ λ§€μΉgrid-area μμ±μ μ¬μ©ν΄ ν΄λΉ itemμμμ μ΄λ¦μ μ§μ ν΄μ£Όλ©΄ λλ€..header { grid-area: header; }
.sidebar-a { grid-area: a; }
.main-content { grid-area: main; }
.sidebar-b { grid-area: b; }
.footer { grid-area: footer; }
/* μ΄λ¦ κ°μ λ°μ΄νκ° μλ κ²μ μ£ΌμνμΈμ */
grid-auto-flow μλ λ°°μΉ.container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(25%, auto));
grid-template-rows: repeat(5, minmax(50px,auto));
grid-auto-flow: dense;
}
item:nth-child(2) { grid-column: auto / span 3; }
item:nth-child(5) { grid-column: auto / span 3; }
item:nth-child(7) { grid-column: auto / span 2; }

align-self κ°λ³ μμ΄ν
μΈλ‘ μ λ ¬columnμΆ) λ°©ν₯μΌλ‘ μ λ ¬νλ€..item {
align-self: stretch;
/* align-self: start; */
/* align-self: center; */
/* align-self: end; */
}
justify-self κ°λ³ μμ΄ν
κ°λ‘ μ λ ¬rowμΆ) λ°©ν₯μΌλ‘ μ λ ¬νλ€..item {
justify-self: stretch;
/* justify-self: start; */
/* justify-self: center; */
/* justify-self: end; */
}
place-selfalign-selfμ justify-selfλ₯Ό κ°μ΄ μΈ μ μλ λ¨μΆ μμ±μ΄λ€..item {
place-self: start center;
}
order λ°°μΉ μμitemλ€μ μκ°μ λμ΄ μμλ₯Ό κ²°μ νλ€. htmlμ체μ ꡬ쑰λ₯Ό λ°κΎΈλκ²μ΄ μλλ―λ‘, μκ°μ₯μ μΈλΆλ€μ΄ μ€ν¬λ¦° 리λλ‘ νλ©΄μ μ½μλλ μλ―Έκ° μμ΄μ§λ μμ±μ΄λ―λ‘ μ£Όμνλ€..item:nth-child(1) { order: 3; } /* A */
.item:nth-child(2) { order: 1; } /* B */
.item:nth-child(3) { order: 2; } /* C */

z-index.item:nth-child(5) {
z-index: 1;
transform: scale(2);
}
/* z-indexλ₯Ό μ€μ μνλ©΄ 0μ΄λ―λ‘, 1λ§ μ€μ ν΄λ λλ¨Έμ§ μμ΄ν
μ λ³΄λ€ μλ‘ μ¬λΌμ¨λ€ */
