Files
2nd/10_Wiki/Topic_Programming/Topic_CSS/CSS_Box_Sizing.md
T
Antigravity Agent e9cbf23ab5 docs(10_Wiki): Dev 폴더 누락분 반영 — Topic_Programming으로 통합
이전 재구성 작업에서 Dev/ 폴더가 누락되었던 것을 반영.

- Dev/Topic_Programming(중첩 폴더, 78개)은 Dev 자체 최상위 폴더들
  (Architecture/Conventions/Engineering_Intelligence 등)과 완전 중복이라 제거.
- Dev 최상위 엔지니어링 지식 폴더(Architecture/Conventions/Engineering_Intelligence/
  Failure_Library/Generalized_Principles/Language/Pattern_Catalog/Platform_Guides/
  Subsystems, 77개)는 이미 Topic_Programming/Topic_Programming에 더 최신 버전이
  존재해 중복 제거(고유 콘텐츠 1개는 예외 처리하여 이동 보존).
- Dev의 W3Schools 언어 튜토리얼 폴더(Topic_C/CPP/CSS/CSharp/HOWTO/HTML/Java/
  JavaScript/PHP/Python/SQL/W3CSS, 1201개)는 전부 Topic_Programming 하위로 이동.
- 에이전트 운영 상태(.astra/docs)는 그대로 유지, 콘텐츠 폴더만 정리.
- Topic_Programming 최종 문서 수: 2784 → 3985.
2026-07-05 00:39:13 +09:00

5.5 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-box-sizing CSS Box Sizing Frontend draft conceptual
box-sizing
border-box
content-box
CSS box model sizing
include padding border in width
B 0.89 2026-06-23 2026-06-23
css
web
frontend
w3schools
box-model
layout
https://www.w3schools.com/css/css3_box-sizing.asp

CSS Box Sizing

🎯 한 줄 통찰 (One-line insight)

The box-sizing property controls whether an element's declared width/height include its padding and border, and setting it to border-box makes sizing predictable so padded boxes don't grow larger than intended. [S1]

🧠 핵심 개념 (Core concepts)

  • Default behavior — by default, an element's actual rendered width and height include the padding and border added on top of the specified width/height. [S1]
  • The sizing formula (default)width + padding + border = actual width of an element, and height + padding + border = actual height of an element. [S1]
  • The problem — two divs with identical width: 300px / height: 100px appear different sizes if one has padding; the padded one is larger. [S1]
  • The fixbox-sizing lets you include padding and borders within the total declared width/height. [S1]
  • Recommended default — applying box-sizing: border-box to all elements via * makes layout sizing consistent. [S1]

🧩 추출된 패턴 (Extracted patterns)

  • border-box pattern — set box-sizing: border-box; so the declared width/height contain padding and border instead of being added to them. [S1]
  • Universal reset pattern* { box-sizing: border-box; } applies predictable sizing to every element. [S1]

📖 세부 내용 (Details)

By default, the actual width and height of an element include the padding and borders added to the specified dimensions: [S1]

  • width + padding + border = actual width of an element [S1]
  • height + padding + border = actual height of an element [S1]

This means two divs given the same width (300px) and height (100px) can appear different — the one with 50px padding is larger because the padding is added to the specified width/height. The box-sizing property solves this by allowing padding and borders to be included in the total width/height calculation. [S1]

Example 1 — without box-sizing (the problem) [S1]

.div1 {
  width: 300px;
  height: 100px;
  border: 1px solid blue;
}

.div2 {
  width: 300px;
  height: 100px;
  padding: 50px;
  border: 1px solid red;
}

Example 2 — with box-sizing: border-box (the solution) [S1]

.div1 {
  width: 300px;
  height: 100px;
  border: 1px solid blue;
  box-sizing: border-box;
}

.div2 {
  width: 300px;
  height: 100px;
  padding: 50px;
  border: 1px solid red;
  box-sizing: border-box;
}

Example 3 — recommended universal application [S1]

* {
  box-sizing: border-box;
}

Property reference [S1]

Property Description
box-sizing Defines how the width and height of an element are calculated: should they include padding and borders, or not

🛠️ 적용 사례 (Applied in summary)

The page's applied examples contrast .div1 and .div2 first without box-sizing (they render at different sizes) and then with box-sizing: border-box (they render identically), and finally recommend the * { box-sizing: border-box; } universal reset. No external project/commit applications found in the source.

💻 코드 패턴 (Code patterns)

Predictable element sizing (language: CSS):

.box {
  width: 300px;
  height: 100px;
  padding: 50px;
  border: 1px solid red;
  box-sizing: border-box;
}

Universal reset (language: CSS):

* {
  box-sizing: border-box;
}

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

  • Default (content-box) sizingwidth/height describe only the content area; padding and border are added on top, so the rendered box is larger than the declared size. Use when you specifically want the content area to be a fixed size. [S1]
  • border-box sizing — padding and border are included within the declared width/height, so a 300px box stays 300px regardless of padding. The page recommends this (including applying it to all elements via *) for predictable layouts. [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)

📚 출처 (Sources)

📝 변경 이력 (Change history)

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