13
Hel8y
8y

Most web developers have to use CSS every now and then. I don't really mind using CSS every know and then, but one thing really bugs me. As a developer, I read ! as "not". In CSS !important becomes "not" important. However, when I read CSS I still read "not" important, when I know this really worked the other way around.

BTW, when I first came across !important many years ago, I really thought it meant a rule was not important, really confusing!

Comments
  • 2
    Beside the confusion you really should avoid using !important. Only if it is really needed and these are rare cases in my opinion. I once saw Code where someone implemented an !important Statement as inline-style... crazy shit.
  • 1
    I hardly use it, but there are some exceptional cases. All of them basically involve a style sheet from a 3rd party which does not have the style you would like.

    Sometimes you cannot alter their style sheet (Twitter and Facebook for example, altering the like button for example is against facebook their policy, but if the client wants it...)

    On the other hand, I sometimes use !important as well to overwrite styles of plugins with predefined style sheets. It is not always the best idea, but I rather use !important then alter the authors CSS file, because it can revert your changes when you update the plugin.
Add Comment