--- id: css-padding title: "CSS Padding" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["padding", "CSS padding", "padding shorthand", "padding-top", "element spacing"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.89 created_at: 2026-06-23 updated_at: 2026-06-23 review_reason: "" merge_history: [] tags: ["css", "web", "frontend", "w3schools", "padding", "box-model"] raw_sources: ["https://www.w3schools.com/css/css_padding.asp"] applied_in: [] github_commit: "" --- # [[CSS Padding]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) The CSS padding properties generate space around an element's content, inside of any defined borders. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **Definition** β€” Padding is used to generate space around an element's content, inside of any defined borders. [S1] - **Four directional properties** β€” `padding-top`, `padding-right`, `padding-bottom`, and `padding-left` set padding on each side individually. [S1] - **Accepted values** β€” length (px, pt, cm, etc.), percentage (% of the containing element's width), or `inherit`. Negative values are not permitted. [S1] - **Shorthand** β€” the `padding` property lets you set all four sides in one declaration. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Per-side control vs. shorthand** β€” use individual `padding-*` properties for asymmetric spacing, or the `padding` shorthand when expressing several sides at once. [S1] - **Clockwise shorthand order** β€” when four values are given, they apply top β†’ right β†’ bottom β†’ left (clockwise from the top). [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) **What padding is** The CSS padding properties are used to generate space around an element's content, inside of any defined borders. [S1] **Individual side properties** CSS provides four properties for setting the padding of each side of an element: [S1] - `padding-top` - `padding-right` - `padding-bottom` - `padding-left` All the padding properties can accept the following values: a length (px, pt, cm, etc.), a percentage (% of the width of the containing element), or `inherit` (the padding is inherited from the parent element). Negative values are not allowed. [S1] **The `padding` shorthand property** To shorten the code, it is possible to specify all the padding properties in one property. The shorthand interprets its values by count: [S1] If the `padding` property has **four** values β€” `padding: 25px 50px 75px 100px;` β€” then: [S1] - top padding is `25px` - right padding is `50px` - bottom padding is `75px` - left padding is `100px` ```css div { padding: 25px 50px 75px 100px; } ``` If the `padding` property has **three** values β€” `padding: 25px 50px 75px;` β€” then: [S1] - top padding is `25px` - right and left padding are `50px` - bottom padding is `75px` ```css div { padding: 25px 50px 75px; } ``` If the `padding` property has **two** values β€” `padding: 25px 50px;` β€” then: [S1] - top and bottom padding are `25px` - right and left padding are `50px` ```css div { padding: 25px 50px; } ``` If the `padding` property has **one** value β€” `padding: 25px;` β€” then all four paddings are `25px`. [S1] ```css div { padding: 25px; } ``` ## πŸ› οΈ 적용 사둀 (Applied in summary) The shorthand declarations above are the page's own applied examples, showing how 1–4 values map to the four sides. No external project/commit applications found in the source. ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Set padding per side (language: CSS): ```css div { padding-top: 25px; padding-right: 50px; padding-bottom: 75px; padding-left: 100px; } ``` Equivalent four-value shorthand: ```css div { padding: 25px 50px 75px 100px; } ``` ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (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 Padding and Box Sizing]], [[CSS Box Model]], [[CSS Height and Width]] - **μ°Έμ‘° λ§₯락:** Referenced whenever inner spacing between content and its border needs to be controlled. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” CSS Padding β€” https://www.w3schools.com/css/css_padding.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-06-23: Initial draft synthesized from the W3Schools "CSS Padding" page (Astra wiki-curation, P-Reinforce v3.1 format).