My old bootcamp teacher told me to never use !important, and after 2 years I finally get why he was partly wrong | CSS Battle Tactics - The Design Community Hub
My old bootcamp teacher told me to never use !important, and after 2 years I finally get why he was partly wrong
Back in 2023 I was in a 12 week front end bootcamp in Chicago and my teacher, this guy named Dev who had worked at a big ad agency, told the whole class to treat !important like a swear word. He said if you ever need it, you already messed up your specificity and you should just refactor. I nodded along and avoided it for almost two years, even when I was fighting some weird third party widget styles for hours. Then a few weeks ago I was building a dark mode toggle for a small shop site and one vendor script kept overriding my body background no matter what selector order I tried. I caved and added one !important, and it worked on the first save. The catch is he was kind of right too, because now I have to remember that line forever or the whole theme breaks. So where do you all draw the line, is it fine for third party patches only, or do you just never touch it?