docs(10_Wiki): 위키 구조 정리 — 언어 튜토리얼 카테고리 폴더 제거 + 신규 자산 동기화
Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고, Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
---
|
||||
id: howto-css-aspect-ratio
|
||||
title: "How To - CSS Aspect Ratio"
|
||||
category: "Web_Recipes"
|
||||
status: "draft"
|
||||
verification_status: "conceptual"
|
||||
canonical_id: ""
|
||||
aliases: ["padding-top aspect ratio hack", "aspect-ratio property"]
|
||||
duplicate_of: ""
|
||||
source_trust_level: "B"
|
||||
confidence_score: 0.83
|
||||
created_at: 2026-07-04
|
||||
updated_at: 2026-07-04
|
||||
review_reason: ""
|
||||
merge_history: []
|
||||
tags: ["howto", "css", "w3schools", "layout", "responsive"]
|
||||
raw_sources: ["https://www.w3schools.com/howto/howto_css_aspect_ratio.asp"]
|
||||
applied_in: []
|
||||
github_commit: ""
|
||||
---
|
||||
|
||||
# [[HOWTO CSS Aspect Ratio]]
|
||||
|
||||
## 🎯 한 줄 통찰 (One-line insight)
|
||||
The classic aspect-ratio hack exploits a CSS quirk that trips up many developers the first time they see it: percentage `padding-top` on a block element is calculated relative to the PARENT'S WIDTH, not its own height — which is precisely why `padding-top: 56.25%` (9÷16) produces a perfect 16:9 box regardless of how wide the container actually is, before the modern `aspect-ratio` property existed to make the intent explicit and readable. [S1]
|
||||
|
||||
## 🧠 핵심 개념 (Core concepts)
|
||||
- **Percentage `padding-top` hack** — `padding-top: X%` on a full-width block is computed against the element's OWN WIDTH (since padding percentages always resolve against the containing block's width), so setting it to a ratio-derived percentage locks the height to a fixed proportion of the width. [S1]
|
||||
- **Ratio-to-percentage formulas**: 1:1 → 100%; 16:9 → 56.25% (9÷16); 4:3 → 75% (3÷4); 3:2 → 66.66% (2÷3); 8:5 → 62.5% (5÷8). [S1]
|
||||
- **`position: relative` + absolutely-positioned child** — needed if text/content must sit inside the ratio-locked box, since the box itself has no "real" height from content. [S1]
|
||||
- **Modern `aspect-ratio` property** — `aspect-ratio: 3 / 2;` directly expresses the same intent in newer browsers (support from roughly Chrome 88 / Firefox 89 / Safari 15 / Edge 88), no padding math required. [S1]
|
||||
|
||||
## 📖 세부 내용 (Details)
|
||||
- 1:1 box: `.container { width: 100%; padding-top: 100%; position: relative; }`. [S1]
|
||||
- Text inside a ratio-locked box: `.text { position: absolute; top: 0; left: 0; bottom: 0; right: 0; }`. [S1]
|
||||
- Modern equivalent: `.container { aspect-ratio: 3 / 2; }`. [S1]
|
||||
|
||||
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
|
||||
없음 — 신규 레시피, 기존 문서와 모순되는 내용 없음.
|
||||
|
||||
## 🛠️ 적용 사례 (Applied in summary)
|
||||
16:9, 4:3, 3:2, 8:5 등 여러 비율을 padding-top 백분율로 구현하는 예제들이 원문에서 직접 나란히 제시됨. [S1]
|
||||
|
||||
## 💻 코드 패턴 (Code patterns)
|
||||
Legacy padding-top hack vs. modern aspect-ratio property (CSS):
|
||||
```css
|
||||
/* Legacy hack -- 16:9 */
|
||||
.container-legacy {
|
||||
width: 100%;
|
||||
padding-top: 56.25%; /* 9 / 16 */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* Modern equivalent */
|
||||
.container-modern {
|
||||
aspect-ratio: 16 / 9;
|
||||
}
|
||||
```
|
||||
|
||||
## ✅ 검증 상태 및 신뢰도
|
||||
- **상태:** draft
|
||||
- **검증 단계:** conceptual
|
||||
- **출처 신뢰도:** B (W3Schools — widely used educational reference)
|
||||
- **신뢰 점수:** 0.83
|
||||
- **중복 검사 결과:** 신규 생성 (New discovery)
|
||||
|
||||
## 🔗 지식 그래프 (Knowledge Graph)
|
||||
- **상위/루트:** [[W3Schools HOW TO]]
|
||||
- **관련 개념:** [[HOWTO CSS Fullscreen Video]], [[HOWTO CSS Image Responsive]]
|
||||
- **참조 맥락:** CSS Layout & Positioning 섹션.
|
||||
|
||||
## 📚 출처 (Sources)
|
||||
- [S1] W3Schools — How To - Aspect Ratio — https://www.w3schools.com/howto/howto_css_aspect_ratio.asp
|
||||
|
||||
## 📝 변경 이력 (Change history)
|
||||
- 2026-07-04: Initial draft synthesized from the W3Schools "How To - Aspect Ratio" recipe (Astra wiki-curation, P-Reinforce v3.1 format).
|
||||
Reference in New Issue
Block a user