9609c04755
W3Schools 튜토리얼을 P-Reinforce v3.1 포맷으로 위키화(영어 본문, 한/영 섹션 헤더). - Topic_HTML: 59문서 (튜토리얼+예제, 레퍼런스/메타 제외) - Topic_CSS: 190문서 (메인 + Advanced/Flexbox/Grid/RWD 전체) - Topic_JavaScript: 120문서 (코어 언어; Temporal/DOM상세/BOM/WebAPI/AJAX/jQuery/Graphics 등은 후속) 각 폴더 00_INDEX.md(MOC) 포함. 코드 verbatim, 미확인분은 "Not found in source" 표기. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
112 lines
4.6 KiB
Markdown
112 lines
4.6 KiB
Markdown
---
|
|
id: css-vertical-align
|
|
title: "CSS Vertical Align"
|
|
category: "Frontend"
|
|
status: "draft"
|
|
verification_status: "conceptual"
|
|
canonical_id: ""
|
|
aliases: ["vertical align", "vertical centering", "flexbox center", "grid place-items", "transform translate center"]
|
|
duplicate_of: ""
|
|
source_trust_level: "B"
|
|
confidence_score: 0.89
|
|
created_at: 2026-06-23
|
|
updated_at: 2026-06-23
|
|
review_reason: ""
|
|
merge_history: []
|
|
tags: ["css", "web", "frontend", "w3schools", "alignment", "flexbox", "grid"]
|
|
raw_sources: ["https://www.w3schools.com/css/css_align_vertical.asp"]
|
|
applied_in: []
|
|
github_commit: ""
|
|
---
|
|
|
|
# [[CSS Vertical Align]]
|
|
|
|
## 🎯 한 줄 통찰 (One-line insight)
|
|
Modern CSS centers content vertically with three approaches — Flexbox (`align-items: center`), Grid (`place-items: center`), or Position + Transform (`top/left: 50%` with `translate(-50%, -50%)`) — the last being the common technique for elements of unknown or dynamic dimensions. [S1]
|
|
|
|
## 🧠 핵심 개념 (Core concepts)
|
|
- **Flexbox vertical centering** — `display: flex` with `justify-content: center` and `align-items: center` centers content within a sized container. [S1]
|
|
- **Grid vertical centering** — `display: grid` with `place-items: center` achieves the same centering effect. [S1]
|
|
- **Position + Transform** — `position: absolute` with `top: 50%`, `left: 50%`, and `transform: translate(-50%, -50%)` centers content. [S1]
|
|
- **Use Position + Transform for unknown sizes** — it is a common technique when dealing with elements of unknown or dynamic dimensions. [S1]
|
|
- **Container setup** — the examples use a 200px-height container with a 3px solid green border. [S1]
|
|
|
|
## 🧩 추출된 패턴 (Extracted patterns)
|
|
- **Flexbox both-axis center** — `display: flex; justify-content: center; align-items: center;`. [S1]
|
|
- **Grid one-liner center** — `display: grid; place-items: center;`. [S1]
|
|
- **Translate -50% center** — absolutely position the child at 50%/50% then pull it back by half its own size with `translate(-50%, -50%)`. [S1]
|
|
|
|
## 📖 세부 내용 (Details)
|
|
**Center Align with Flexbox** [S1]
|
|
```css
|
|
.center {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 200px;
|
|
border: 3px solid green;
|
|
}
|
|
```
|
|
|
|
**Center Align with Grid** [S1]
|
|
```css
|
|
.center {
|
|
display: grid;
|
|
place-items: center;
|
|
height: 200px;
|
|
border: 3px solid green;
|
|
}
|
|
```
|
|
|
|
**Center Align with `position` and `transform`**
|
|
For elements of unknown or dynamic dimensions, this is a common technique. The example sets `margin: 0` on the paragraph and centers it: [S1]
|
|
```css
|
|
.container p {
|
|
margin: 0;
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 50%;
|
|
transform: translate(-50%, -50%);
|
|
}
|
|
```
|
|
The page directs readers to the 2D Transforms chapter for a deeper understanding of the `transform` property. [S1]
|
|
|
|
## 🛠️ 적용 사례 (Applied in summary)
|
|
The page's own applied examples are vertically centering content with Flexbox, with Grid (`place-items`), and with Position + Transform inside a 200px-height bordered container. No external project/commit applications found in the source.
|
|
|
|
## 💻 코드 패턴 (Code patterns)
|
|
Position + transform centering (language: CSS):
|
|
```css
|
|
.container p {
|
|
margin: 0;
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 50%;
|
|
transform: translate(-50%, -50%);
|
|
}
|
|
```
|
|
|
|
## ⚖️ 비교 및 선택 기준 (Comparison & decision criteria)
|
|
- **Flexbox vs Grid vs Position+Transform** — Flexbox and Grid are modern container-driven techniques for vertical centering; Position + Transform is the common choice when the element has unknown or dynamic dimensions because `translate(-50%, -50%)` offsets by the element's own measured size. [S1]
|
|
|
|
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
|
|
No contradictions found in the source.
|
|
|
|
## ✅ 검증 상태 및 신뢰도
|
|
- **상태:** draft
|
|
- **검증 단계:** conceptual (실제 적용 사례 발견 시 applied/validated로 승격 가능)
|
|
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
|
|
- **신뢰 점수:** 0.89
|
|
- **중복 검사 결과:** 신규 생성 (New discovery)
|
|
|
|
## 🔗 지식 그래프 (Knowledge Graph)
|
|
- **상위/루트:** [[CSS Tutorial]]
|
|
- **관련 개념:** [[CSS Center Align]], [[CSS Horizontal Align]], [[CSS Flexbox]], [[CSS Grid]]
|
|
- **참조 맥락:** Referenced when vertically centering content, especially elements whose height is not known in advance.
|
|
|
|
## 📚 출처 (Sources)
|
|
- [S1] W3Schools — CSS Vertical Align — https://www.w3schools.com/css/css_align_vertical.asp
|
|
|
|
## 📝 변경 이력 (Change history)
|
|
- 2026-06-23: Initial draft synthesized from the W3Schools "CSS Vertical Align" page (Astra wiki-curation, P-Reinforce v3.1 format).
|