When we use !important exception and why we use it


Theimportant the rule is used on a style declaration and this declaration overrides any other declarations. Although technically!important has nothing to do with specificity, it interacts directly with it. Using!important, however, isnot good practice and should be avoided. Because it does debug more difficult by breaking the naturalcascadingin your stylesheets. When two conflicting declarations with the!importantrule are applied to the same element, the declaration with a greater specificity will be applied.

You should use it when:

  1. You have a global CSS file that sets visual aspects of your site globally.
  2. or you have to use an inline style element. it’s very bad practice.
  3. in WordPress when you use the WordPress plugin and you want to style it you use !importantfor overwriting the style.

We're Ready, Let's Talk