What you need to know

Specificity decides which matching selector wins when declarations conflict. Excessively specific selectors make a codebase harder to override, while source order and cascade layers also affect the final result.

How to apply it

Prefer simple class selectors, keep component styles near their component, and inspect the browser's computed styles when a rule does not apply. Use a consistent design token or utility convention for shared values.

Common mistake to avoid

Avoid repeatedly adding IDs or !important to defeat earlier rules. Reduce the original conflict or define a clear layer for intentional overrides.