--- id: css-important title: "CSS !important" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["!important", "important rule", "CSS override priority", "important declaration", "highest priority CSS"] 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", "important", "cascade", "specificity"] raw_sources: ["https://www.w3schools.com/css/css_important.asp"] applied_in: [] github_commit: "" --- # [[CSS !important]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) The `!important` rule forces a CSS property value to the highest priority, overriding every other styling rule for that property on an element β€” powerful, but to be used sparingly. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **Highest priority** β€” `!important` assigns the highest priority to a CSS property value, overriding all previous styling rules for that specific property on an element. [S1] - **Overrides specificity** β€” an `!important` declaration beats inline styles, ID selectors, and class selectors even though those would normally have higher specificity. [S1] - **Use sparingly** β€” overusing `!important` creates confusing, difficult-to-debug CSS code. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Property-level override pattern** β€” append `!important` to a single declaration (`property: value !important;`) to lock that one property's value. [S1] - **Accessibility escape hatch** β€” pairing `!important` with a `prefers-reduced-motion` media query guarantees motion is suppressed for users who request it. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) **What `!important` does.** The `!important` rule assigns the highest priority to a CSS property value, overriding all previous styling rules for that specific property on an element. [S1] **Syntax.** [S1] ```css selector { property: value !important; } ``` **Example β€” basic override.** When `background-color: yellow !important;` is applied to paragraphs, all the paragraphs display a yellow background regardless of inline styles, ID selectors, or class selectors that would otherwise have higher specificity. [S1] ```css p { background-color: yellow !important; } ``` **Example β€” accessibility / reduced motion.** `!important` is used to respect a user's motion-sensitivity preference, forcing animations and transitions off for everyone who requests reduced motion. [S1] ```css @media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } } ``` **Other examples on the page.** The page also shows competing/multiple `!important` declarations across different selectors (illustrating how this can create confusing CSS) and a link-button styling case where `!important` enforces consistent styling across conflicting selectors. The exact additional source code for these boxes was not captured verbatim from the source. [S1] (Not found in source β€” verbatim code.) **Fair use cases.** The page lists legitimate reasons to use `!important` [S1]: 1. Overriding styles in a Content Management System (CMS) where the CSS cannot be edited directly. 2. Respecting user accessibility preferences (such as reduced motion). 3. Creating unchangeable styles for specific elements. **Warning.** Use `!important` sparingly β€” excessive use creates confusing, difficult-to-debug CSS code. [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) The page's applied demonstrations include forcing a yellow paragraph background over higher-specificity rules, and the `prefers-reduced-motion` accessibility block that kills animations and transitions. No external project/commit applications found in the source. ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Locking a single property (language: CSS): ```css selector { property: value !important; } ``` Accessibility-driven blanket override (language: CSS): ```css @media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } } ``` ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (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 Specificity Hierarchy]], [[CSS Accessibility]] - **μ°Έμ‘° λ§₯락:** Reached for when a style must override everything else, or when ruling out an `!important` rule as the cause of an un-overridable style. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” CSS !important β€” https://www.w3schools.com/css/css_important.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-06-23: Initial draft synthesized from the W3Schools "CSS !important" page (Astra wiki-curation, P-Reinforce v3.1 format).