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>
5.2 KiB
id, title, category, status, verification_status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, created_at, updated_at, review_reason, merge_history, tags, raw_sources, applied_in, github_commit
| id | title | category | status | verification_status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | created_at | updated_at | review_reason | merge_history | tags | raw_sources | applied_in | github_commit | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| css-horizontal-align | CSS Horizontal Align | Frontend | draft | conceptual |
|
B | 0.89 | 2026-06-23 | 2026-06-23 |
|
|
CSS Horizontal Align
🎯 한 줄 통찰 (One-line insight)
Horizontal alignment in CSS depends on the element: margin: auto (with a width) centers block elements, text-align: center centers text, auto left/right margins center images, and position: absolute or float push elements to the left or right. [S1]
🧠 핵심 개념 (Core concepts)
- Center block elements with
margin: auto— used to horizontally center a block-level element like<div>. [S1] - Width is required for margin auto — the example sets
width: 50%; centering withmargin: autoneeds a defined width to take effect. [S1] - Center text with
text-align: center— used to center text inside a block-level element. [S1] - Center an image — set
margin-leftandmargin-righttoautoand turn the image into ablockelement. [S1] - Directional alignment —
position: absolute(withright/left) orfloatpush an element to one side. [S1] - Absolute positioning caveat — absolute positioned elements are removed from the normal flow, and can overlap other elements. [S1]
🧩 추출된 패턴 (Extracted patterns)
- Block centering pattern —
margin: auto+ an explicitwidth. [S1] - Image centering pattern —
display: block+margin-left: auto+margin-right: auto. [S1] - Right-align patterns —
position: absolute; right: 0px;(removed from flow) orfloat: right;(stays in flow). [S1]
📖 세부 내용 (Details)
Center Align Block Elements
Use margin: auto;, to horizontally center a block-level element (like <div>). [S1]
.center {
margin: auto;
width: 50%;
border: 3px solid green;
padding: 10px;
}
Center Align Text
To center the text inside a block-level element, use text-align: center;. [S1]
p {
text-align: center;
}
Center Align an Image
To center an image, set margin-left and margin-right to auto, and also turn the image into a block element. [S1]
img {
display: block;
margin-left: auto;
margin-right: auto;
width: 40%;
}
Left and Right Align — Using position
Another method for aligning elements is to use position: absolute;. Note: absolute positioned elements are removed from the normal flow, and can overlap other elements. [S1]
.right {
position: absolute;
right: 0px;
width: 300px;
border: 3px solid green;
padding: 10px;
}
Left and Right Align — Using float
Another method for aligning an element to the left or right is to use the float property. [S1]
.right {
float: right;
width: 300px;
border: 3px solid green;
padding: 10px;
}
🛠️ 적용 사례 (Applied in summary)
The page's own applied examples are: centering a block div with margin: auto, centering paragraph text, centering an image, right-aligning with position: absolute, and right-aligning with float. No external project/commit applications found in the source.
💻 코드 패턴 (Code patterns)
Center a block element (language: CSS):
.center {
margin: auto;
width: 50%;
}
Center an image:
img {
display: block;
margin-left: auto;
margin-right: auto;
width: 40%;
}
⚖️ 비교 및 선택 기준 (Comparison & decision criteria)
position: absolutevsfloatfor right alignment — both push an element to the right, butposition: absoluteremoves the element from the normal flow (it can overlap other elements), whereasfloat: rightkeeps it in the flow. [S1]- By content type — block elements →
margin: auto; text →text-align: center; images → block + auto side margins. [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 Vertical Align, CSS Float Examples, CSS Position
- 참조 맥락: Referenced when horizontally centering or side-aligning blocks, text, and images.
📚 출처 (Sources)
- [S1] W3Schools — CSS Horizontal Align — https://www.w3schools.com/css/css_align_horizontal.asp
📝 변경 이력 (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "CSS Horizontal Align" page (Astra wiki-curation, P-Reinforce v3.1 format).