Hacker News new | ask | show | jobs
by igotsideas 3456 days ago
Why is there over 1000 !important's in bootstrap.css? I always thought 1 !important was a big no no.
5 comments

Folks seemed to expect the `!important`s to always ensure the utility classes are applied properly. https://twitter.com/mdo/status/684261888046190594
Purism sounds nice in theory, but in practice I have yet to come across a project where at some point an `!important` (or 2) NOT becomes necessary, where it then NOT seems utterly acceptable and in fact fully in line with "the proper natural purpose of !important" (subjectively+situationally perceived, of course) and moreover the only solution to not spend 1-2 weeks refactoring the entire project's very own ad-hoc CSS philosophy/entirety-of-interactions..

(In a framework, different matter quite possibly. Don't they use only-their-own-class-names anyway? Nevermind..)

Contrived example, but one that probably accounts for a LOT of the !importants are utility classes, say .bold. If you put on that class you want to be sure it's getting applied, regardless of the styles which may come before or after it.
Could that be avoided if the design of the framework would of kept specificity in mind or does that not matter in that case?
It is, but CSS is also fundamentally broken so whatever