2023. 3. 8. 17:57γDev./CSS
π display μμ± μ€ gridμ λν΄ μ 리.
grid
μμ μμλ€μ΄ 컨ν μ΄λ μ 곡κ°μ λ§μΆκΈ° μν΄ ν¬κΈ°λ₯Ό ν€μ°κ±°λ μ€μ΄λ λ°©λ²
λΆλͺ¨μμλ₯Ό grid-container μμμμλ₯Ό grid-item
μΉνμ΄μ§λ₯Ό μν 2μ°¨μ λ μ΄μμ(xμΆ, yμΆ) μμ€ν
grid-container μμ±
μλμ μμ±λ€μ grid-container(λΆλͺ¨ μμ)μμ μ¬μ©λλ μμ±μ΄λ€.
grid-template-columns
- μ΄λ°©ν₯ 그리λ νΈλμ μ¬μ΄μ¦ μ€μ
grid-template-rows
- νλ°©ν₯ 그리λ νΈλμ μ¬μ΄μ¦ μ€μ
π‘μλ‘μ΄ λ¨μ fr
- fraction: λΆμ
- 컨ν μ΄λλ₯Ό λΆν
- grid 컨ν μ΄λ μμμ νΈλμ λΉμ¨μ μ§μ ν΄μ£Όλ μ μ°ν κΈΈμ΄ λ¨μ
- 1fr 1fr 1frμ 1:1:1 μ λΉμ¨μ μλ―Έν¨
grid-template-areas
그리λ μμ΄λ¦¬μ΄λ₯Ό μ€μ ν¨μΌλ‘μ¨ μμ΄ν λ€μ΄ κ°μ§λ 곡κ°μ ν©μΉκ±°λ λλ μ μλ€.
See the Pen Untitled by astinaus (@astinaus) on CodePen.
ν¨μ
- repeat()
- row νΉμ column λ°©ν₯μΌλ‘ 그리λ νΈλμ μ¬μ΄μ¦λ₯Ό μ’ λ κ°λ¨ν ννλ‘ νννλλ‘ λμμ£Όλ ν¨μ.
- ν¨μμ μ λ¬νλ 첫λ²μ§Έ μΈμλ λ°λ³΅ νμ, λλ²μ§Έ μΈμλ λ°λ³΅ν κ°.
- minmax()
- 그리λμμ μ΅μμ μ΅λ μ¬μ΄μ λ²μλ₯Ό μ€μ .
- μ΅μκ°κ³Ό μ΅λκ°μ μλ―Ένλ λκ°μ§ μΈμλ₯Ό κ°μ§.
- minλ³΄λ€ ν¬κ±°λ κ°κ³ , maxλ³΄λ€ μκ±°λ κ°μ ν¬κΈ° λ²μλ₯Ό μ μ.
auto-fill & auto-fit
- repeat ν¨μλ₯Ό μ¬μ©ν λ, λ°λ³΅λλ μΉ΄μ΄νΈλ₯Ό κ³ μ νμ§ μκ³ μ»¨ν
μ΄λμ λμ΄μ λ°λΌ
κ°λ₯ν λ§μ 그리λ 컬λΌμ λ°°μΉνκ³ μΆλ€λ©΄ μ¬μ©νλ ν€μλ κ°. - auto-fill: κ°λ₯ν λ§μ μ λ€μ λ§λ¦. λΉ κ³΅κ°μ΄ μκΉ
- auto-fit: 그리λ 컨ν μ΄λ λ΄λΆμ 곡κ°μ΄ λ¨μ κ²½μ°, κ·Έ 곡κ°μ κ° μ λ€μ΄ λλ κ°μ§.
gap
μ κ³Ό μ μ¬μ΄μ κ°κ²© μ€μ .
볡μ‘ν λ μ΄μμμμ margin λμ νΈλ¦¬νκ² κ°κ²© μ€μ κ°λ₯
align-content
- 그리λ μ½ν μΈ μ μμ§(μ΄) μ λ ¬
- 그리λ μ½ν μΈ μ μΈλ‘ λμ΄κ° 그리λ 컨ν μ΄λλ³΄λ€ μμμΌ ν¨.
- stretch, center, start, end, space-around, space-between, space-evenly
justify-content
- 그리λ μ½ν μΈ μ μν(ν) μ λ ¬
- 그리λ μ½ν μΈ μ κ°λ‘ λμ΄κ° 그리λ 컨ν μ΄λλ³΄λ€ μμμΌ ν¨.
- stretch, center, start, end, space-around, space-between, space-evenly
align-items
- μ§κ³ μμμ λν μμ§(μ΄) μ λ ¬μ λͺ¨λ λμΌνκ² μ€λ€.
- stretch, center, start, end
justify-items
- μ§κ³ μμμ λν μν(ν) μ λ ¬μ λͺ¨λ λμΌνκ² μ€λ€.
- stretch, center, start, end
grid-item μμ±
μλ μμ±μ grid-item(μμ μμ)μμ μ¬μ©νλ μμ±
grid-area
grid-template-areas μ ν¨κ» μ¬μ©ν μλ μκ³ , μμ΄ν μ grid-areaλ₯Ό λ¨λ μ μΌλ‘ μ¬μ©ν μλ μλ€.
grid-row-start: 1; /* 1 */
grid-row-end: 2; /* 3 */
grid-column-start: 1; /* 2 */
grid-column-end: 4; /* 4 */
grid-row: 1/2;
grid-column: 1/4;
grid-area: 1/1/2/4;
grid-area: 1/1/1/span 3;
π‘span
- spanμ μ¬μ μ μλ―Έ: ‘ν λΌ’, ‘~μ μ±μ°λ€’
- 그리λμμ νκ³Ό μ΄μ λ³ν©ν λ span ν€μλλ₯Ό μ¬μ©νλ€.
z-index
grid μμμ z-index μμ±μΌλ‘ νλ©΄μ 보μ¬μ§λ μ°μ μμλ₯Ό μ€μ κ°λ₯.
position μμ±μ μ¬μ©νμ§ μλλΌλ κ°λ₯ν¨.
grid
- λ¨μΆμμ±
- grid-template-rows grid-template-columns grid-template-areas grid-auto-rows grid-auto-columns grid-auto-flow
grid: auto-flow / 1fr 1fr 1fr;
grid: auto-flow dense / 40px 40px 1fr;
'Dev. > CSS' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[2023.03.08] 11. display: flex (0) | 2023.03.08 |
---|---|
[2023.03.08] 10. display: float (0) | 2023.03.08 |
[2023.03.06] 9. display μμ± / position / reset.css (0) | 2023.03.06 |
[2023.03.03] 8. CSS Box Model (0) | 2023.03.03 |
[2023.03.03] 7. CSS μ νμ(κ°μ ν΄λμ€ / κ°μ μμ) (0) | 2023.03.03 |