DEV Community

Discussion on: Is it really !important?

Collapse
 
codeability profile image
E.J. Mason

I have in the past used !important to ensure that certain utility classes are honored - like a .visually-hidden utility. It's probably overkill in codebases you can 100% manage, but if you're trying to help a client get the hang of screen-reader-only content, using !important miiiiiight make sense.

Great article, Kayla! Thanks for writing (and motivating me to make an account here!).

Collapse
 
kayla profile image
Kayla Sween

Definitely! I've gotten spoiled by Bootstrap's .sr-only and .sr-only-focusable classes, so using it for a visually hidden element slipped my mind. Improving accessibility is always a more than valid use case.

Thanks again! And it's no problem!