Loading...
Loading...
CSS rule not being applied (overridden by more specific selector)CSS specificity determines which rule wins when multiple rules target the same element. If your style isn't applying, a more specific selector is overriding it. Specificity is calculated as: inline styles > IDs > classes/attributes > elements.
Make your selector more specific to win the cascade.
/* ❌ Low specificity — gets overridden */
.button { color: red; }
/* ✅ Higher specificity */
.container .button { color: red; }
/* ✅ Or add a more specific class */
.button.button-primary { color: red; }!important overrides all other declarations, but use sparingly.
/* Only use when you can't increase specificity */
.button { color: red !important; }Open Chrome DevTools → Elements → Styles. Crossed-out rules are being overridden. Hover over the selector to see its specificity score.