--- id: css-inheritance title: "CSS Inheritance" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["CSS inheritance", "inherited properties", "non-inherited properties", "inherit keyword", "property inheritance"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.87 created_at: 2026-06-23 updated_at: 2026-06-23 review_reason: "" merge_history: [] tags: ["css", "web", "frontend", "w3schools", "inheritance", "cascade"] raw_sources: ["https://www.w3schools.com/css/css_inheritance.asp"] applied_in: [] github_commit: "" --- # [[CSS Inheritance]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) CSS inheritance governs what happens when no value is specified for a property on an element: some properties (typically text-related) inherit their parent's value, others (box-model/layout) do not, and the `inherit` keyword forces inheritance explicitly on either kind. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **What inheritance is** β€” CSS inheritance is about what happens if no value is specified for a property on an element; values either inherit from parent elements or default to initial values. [S1] - **Inherited properties** β€” text-related properties like `color`, `font-family`, `font-size`, `line-height`, and `text-align` are typically inherited, ensuring consistent styling throughout a document. [S1] - **Non-inherited properties** β€” box-model/layout properties like `border`, `background`, `margin`, `padding`, `width`, and `height` typically do not inherit. [S1] - **`inherit` keyword** β€” used to explicitly specify inheritance; it works on both inherited and non-inherited properties. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Rely on inheritance for typography** β€” set text properties on a container and let descendants inherit them rather than repeating declarations. [S1] - **Force inheritance with `inherit`** β€” when a non-inheriting property (like `border`) should match the parent, set it explicitly to `inherit`. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) **CSS Inheritance** CSS inheritance is about what happens if no value is specified for a property on an element. The value either inherits from parent elements or defaults to initial values. [S1] **Inherited Properties** Text-related properties such as `color`, `font-family`, `font-size`, `line-height`, and `text-align` are typically inherited so styling stays consistent throughout the document. A `

` element with `color: blue` and `font-size: 20px` passes these values to a nested `` element: [S1] ```css p { color: blue; font-size: 20px; } ``` ```html

This is a paragraph with some important text.

``` **Non-inherited Properties** Properties related to the box model and layout β€” `border`, `background`, `margin`, `padding`, `width`, `height` β€” typically do not inherit. A `` element inside a bordered `

` will not inherit the border unless explicitly stated: [S1] ```css p { border: 1px solid red; } ``` ```html

This is a paragraph with some important text.

``` **The inherit Keyword** The `inherit` keyword is used to explicitly specify inheritance. It works on both inherited and non-inherited properties. Setting `border: inherit` on a `` element makes it inherit the parent's border value: [S1] ```css p { border: 1px solid red; } strong { border: inherit; } ``` ```html

This is a paragraph with some strong text.

``` The `initial`, `unset`, and `revert` keywords, and the `all` property, are: Not found in source. [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) The page's applied cases are: a paragraph passing `color`/`font-size` to a nested ``, a bordered paragraph whose `` does not inherit the border, and a `` forced to take the parent's border via `border: inherit`. No external project/commit applications found in the source. ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Inherited text styling (language: CSS): ```css p { color: blue; font-size: 20px; } ``` Force a non-inherited property to inherit (language: CSS): ```css strong { border: inherit; } ``` ## βš–οΈ 비ꡐ 및 선택 κΈ°μ€€ (Comparison & decision criteria) - **Inherited properties** (e.g., `color`, `font-family`, `font-size`, `line-height`, `text-align`) β€” descendants take the parent's value automatically; rely on this for consistent typography. [S1] - **Non-inherited properties** (e.g., `border`, `background`, `margin`, `padding`, `width`, `height`) β€” descendants do not take the parent's value; use the `inherit` keyword when you explicitly want them to. [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.87 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[CSS Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[CSS Specificity]], [[CSS Cascade]], [[CSS Selectors]] - **μ°Έμ‘° λ§₯락:** Referenced when reasoning about why descendant elements pick up (or do not pick up) styles from their ancestors. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” CSS Inheritance β€” https://www.w3schools.com/css/css_inheritance.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-06-23: Initial draft synthesized from the W3Schools "CSS Inheritance" page (Astra wiki-curation, P-Reinforce v3.1 format).