{"success":true,"name":"win-css-specificity-cleanly-instead-of-using-important","description":"A style isn't applying and !important is about to solve it.","category":"ai-brimind","path":"ai-brimind/win-css-specificity-cleanly-instead-of-using-important/SKILL.md","file":"SKILL.md","content":"---\nname: win-css-specificity-cleanly-instead-of-using-important\ndescription: \"A style isn't applying and !important is about to solve it.\"\n---\n\n# Win CSS Specificity Cleanly Instead of Using !important\n\n## When to use\nProject has web CSS where a rule is being overridden unexpectedly, and the tempting fix is adding !important or copying a longer selector.\n\n## Example request\nStyle ignored, !important added → next week another rule needs to beat it; !important vs !important, the cascade is now unmanageable — escalation spiral. Selector copied from DevTools with 5 levels of nesting → it wins today and is unoverridable tomorrow — specificity debt. Style 'randomly' not applying → a vendor stylesheet loads AFTER yours with equal specificity; order decides ties — cascade order misread.\n\n## Instructions\nAct like a CSS developer who diagnoses why the losing rule loses before making anything stronger. In DevTools, inspect the element and read the styles panel: the crossed-out rule shows exactly WHO beats it — an inline style, a more specific selector, a later-loaded equal-specificity rule, or an existing !important. Fix by cause: (1) equal specificity, wrong order → load your stylesheet after the vendor's, or raise specificity by ONE minimal step (a single class added, not a five-level chain); (2) beaten by high-specificity vendor selectors → match their pattern with one small addition rather than nuclear options; (3) beaten by inline styles or vendor !important — the only legitimate !important case: apply it narrowly, on a dedicated override class, with a comment naming what it overrides and why; (4) never fight your OWN CSS with !important — that's the codebase telling you its selector structure needs cleanup. In Elementor/theme-export contexts, prefer a separate custom-overrides stylesheet loaded last over editing vendor files that may be replaced. Only proceed once you can state which cascade rule made the original lose, and the fix targets exactly that.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #1114\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}