Files
2nd/10_Wiki/Topic_CSS/CSS_Padding_Box_Sizing.md
T
koriweb 9609c04755 docs(10_Wiki): W3Schools 위키화 — HTML/CSS/JavaScript(core)
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>
2026-06-23 19:21:18 +09:00

5.0 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-padding-and-box-sizing CSS Padding and Box Sizing Frontend draft conceptual
padding box sizing
box-sizing border-box
padding width
border-box
content-box
B 0.88 2026-06-23 2026-06-23
css
web
frontend
w3schools
padding
box-sizing
box-model
https://www.w3schools.com/css/css_padding_box-sizing.asp

CSS Padding and Box Sizing

🎯 한 줄 통찰 (One-line insight)

The width property sets only the content area, so padding adds to the total rendered width — unless box-sizing: border-box makes the declared width include padding and border. [S1]

🧠 핵심 개념 (Core concepts)

  • Width is content-only by default — the CSS width property specifies the width of the content area; padding applied to an element with a defined width extends the total element width beyond that value. [S1]
  • The box-sizing property — controls how width and height calculations include or exclude padding and borders. [S1]
  • content-box (default) — width and height include only the content; padding and borders are added separately. [S1]
  • border-box — width and height include content, padding, and border together. [S1]

🧩 추출된 패턴 (Extracted patterns)

  • Unexpected widening — adding padding to a fixed-width element grows its total size, which is often undesirable. [S1]
  • Predictable sizing with border-box — set box-sizing: border-box so the declared width is preserved and padding eats into the content space instead of expanding the box. [S1]

📖 세부 내용 (Details)

Padding and element width The CSS width property specifies only the width of the content area. When padding is applied to an element with a defined width, the padding extends the total element width beyond the specified value. [S1]

For example: [S1]

div {
  width: 300px;
  padding: 25px;
}

Here the actual rendered width becomes 350px (300px content + 25px left padding + 25px right padding), which is often undesirable. [S1]

Solution: the box-sizing property The box-sizing property controls how the width and height of an element are calculated with respect to padding and borders. It accepts two primary values: [S1]

  • content-box (default): width and height include only the content; padding and borders are added separately.
  • border-box: width and height include the content, padding, and border together.

Recommended example: [S1]

div {
  width: 300px;
  padding: 25px;
  box-sizing: border-box;
}

With border-box, the element keeps exactly 300px width; increasing padding reduces the available content space rather than expanding the total width. [S1]

Related padding properties The page includes a reference table of five padding properties: padding (shorthand), padding-bottom, padding-left, padding-right, and padding-top. [S1]

🛠️ 적용 사례 (Applied in summary)

The two div examples are the page's own applied cases: the first shows the widening problem; the second fixes it with box-sizing: border-box. No external project/commit applications found in the source.

💻 코드 패턴 (Code patterns)

Keep a fixed footprint while still using padding (language: CSS):

div {
  width: 300px;
  padding: 25px;
  box-sizing: border-box;
}

⚖️ 모순 및 업데이트 (Contradictions & updates)

No contradictions found in the source.

⚖️ 비교 및 선택 기준 (Comparison & decision criteria)

  • content-box (default) — choose when you want width to mean strictly the content area and you intend to add padding/border on top of it. [S1]
  • border-box — choose when you want the declared width/height to remain the element's total footprint regardless of padding and border; padding then reduces inner content space instead of enlarging the box. [S1]

검증 상태 및 신뢰도

  • 상태: draft
  • 검증 단계: conceptual (실제 적용 사례 발견 시 applied/validated로 승격 가능)
  • 출처 신뢰도: B (W3Schools — widely used educational reference, not a primary standards body)
  • 신뢰 점수: 0.88
  • 중복 검사 결과: 신규 생성 (New discovery)

🔗 지식 그래프 (Knowledge Graph)

📚 출처 (Sources)

📝 변경 이력 (Change history)

  • 2026-06-23: Initial draft synthesized from the W3Schools "CSS Padding and Box Sizing" page (Astra wiki-curation, P-Reinforce v3.1 format).