1cfd3bbb56
Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고, Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
3.3 KiB
3.3 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 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| howto-css-center-website | How To - Center Website | Web_Recipes | draft | conceptual |
|
B | 0.82 | 2026-07-04 | 2026-07-04 |
|
|
HOWTO CSS Center Website
🎯 한 줄 통찰 (One-line insight)
margin: auto only centers a block horizontally if the element has an EXPLICIT width (here via max-width) — an unconstrained block always stretches to fill its parent, leaving no leftover space for the browser to distribute as equal left/right margins, which is the entire reason this recipe pairs max-width: 500px with margin: auto rather than using either alone; this is the simplest of all the centering recipes in this cookbook because it needs neither position, transform, nor Flexbox — just a width constraint plus auto margins. [S1]
🧠 핵심 개념 (Core concepts)
margin: autorequires a constrained width — auto margins only distribute leftover horizontal space; a full-width block has none to distribute. [S1]max-widthinstead ofwidth— allows the content wrapper to shrink on narrow viewports (spanning the full page below the breakpoint) while capping its width on wide screens. [S1]- No positioning/transform/flexbox needed — the simplest technique in this cookbook's centering family, applicable to whole-page content wrappers rather than individual elements. [S1]
📖 세부 내용 (Details)
.content { max-width: 500px; margin: auto; }applied to a wrapper<div>directly inside<body>. [S1]- Below 500px viewport width, the content spans the full page (since
max-widthstops constraining once the viewport is narrower than it). [S1]
⚖️ 모순 및 업데이트 (Contradictions & updates)
없음 — 신규 레시피, 기존 문서와 모순되는 내용 없음.
🛠️ 적용 사례 (Applied in summary)
페이지 콘텐츠를 500px 폭으로 제한하고 margin:auto로 가로 중앙 정렬해, 500px보다 좁은 화면에서는 전체 폭을 차지하게 만드는 예제가 원문에서 직접 제시됨. [S1]
💻 코드 패턴 (Code patterns)
Centering a whole page's content with max-width + margin:auto (CSS):
.content {
max-width: 500px;
margin: auto;
}
✅ 검증 상태 및 신뢰도
- 상태: draft
- 검증 단계: conceptual
- 출처 신뢰도: B (W3Schools — widely used educational reference)
- 신뢰 점수: 0.82
- 중복 검사 결과: 신규 생성 (New discovery)
🔗 지식 그래프 (Knowledge Graph)
- 상위/루트: W3Schools HOW TO
- 관련 개념: HOWTO CSS Center Button, HOWTO CSS Full Page
- 참조 맥락: CSS Layout & Positioning 섹션.
📚 출처 (Sources)
- [S1] W3Schools — How To - Center Website — https://www.w3schools.com/howto/howto_css_center_website.asp
📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "How To - Center Website" recipe (Astra wiki-curation, P-Reinforce v3.1 format).