--- id: css-height-and-width title: "CSS Height and Width" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["height", "width", "CSS height", "CSS width", "element dimensions"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.88 created_at: 2026-06-23 updated_at: 2026-06-23 review_reason: "" merge_history: [] tags: ["css", "web", "frontend", "w3schools", "height", "width", "box-model"] raw_sources: ["https://www.w3schools.com/css/css_height_width.asp"] applied_in: [] github_commit: "" --- # [[CSS Height and Width]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) The `height` and `width` properties set the size of the area inside the padding, border, and margin of an element β€” they do not include padding, borders, or margins. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **Purpose** β€” the `height` and `width` properties set the height and width of the area inside the padding, border, and margin of the element. [S1] - **Content-only** β€” these properties size the content area; they do not include padding, borders, or margins in their calculations. [S1] - **Accepted values** β€” `auto` (browser calculates dimensions; default), a length (px, cm, em, etc.), `%` (percentage of the containing block), `initial` (default value), or `inherit` (inherited from parent). [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Fixed vs. fluid** β€” combine a length on one axis with a `%` on the other (e.g., fixed `height` + percentage `width`) for partially responsive boxes. [S1] - **Content-box mental model** β€” when reasoning about an element's footprint, add padding and border to the declared `height`/`width`, since those are excluded. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) **What height and width do** The CSS `height` and `width` properties set the height and width of the area inside the padding, border, and margin of the element. This means they do not include padding, borders, or margins in their calculations. [S1] **Accepted values** The `height` and `width` properties accept: [S1] - `auto` β€” the browser calculates the dimensions (this is the default) - a length β€” specific values in px, cm, em, etc. - `%` β€” a percentage of the containing block - `initial` β€” sets the property to its default value - `inherit` β€” the property is inherited from the parent **Example 1** β€” fixed height with percentage width: [S1] ```css div { height: 200px; width: 50%; background-color: powderblue; } ``` **Example 2** β€” fixed height and fixed width: [S1] ```css div { height: 100px; width: 500px; background-color: powderblue; } ``` **Note** The tutorial emphasizes: "Remember that the height and width properties do not include padding, borders, or margins!" [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) The two `div` examples are the page's own applied cases, demonstrating fixed and percentage-based sizing. No external project/commit applications found in the source. ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Size a box's content area (language: CSS): ```css div { height: 200px; width: 50%; background-color: powderblue; } ``` ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) No contradictions found in the source. ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual (μ‹€μ œ 적용 사둀 발견 μ‹œ applied/validated둜 승격 κ°€λŠ₯) - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.88 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[CSS Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[CSS Max-width and Min-width]], [[CSS Box Model]], [[CSS Padding and Box Sizing]] - **μ°Έμ‘° λ§₯락:** Referenced whenever an element's content-area dimensions must be set explicitly. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” CSS Height and Width β€” https://www.w3schools.com/css/css_height_width.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-06-23: Initial draft synthesized from the W3Schools "CSS Height and Width" page (Astra wiki-curation, P-Reinforce v3.1 format).