* The important rule is mainly used for debugging.
* It is called into play when we have a specificity conflict in our CSS.
* A rule with the important property will always be applied no matter where it sits in the document.
* The important rule overrides any specificity conflict as important has the highest possible specificity value.
* If two styles have equal specificity then the latter rule will always apply.
* However if we have p {color:#0c0 !important} then this rule will now be applied.
* If you have a rule that's not being applied, use the important rule to find the specificity conflict.
* If it doesn't fix it then chances are you just have a spelling mistake or you have got the name of the selector wrong.
* NB: Use the important directive to debug but DO NOT leave it in the style sheet for deployment as it will cause you problems further down the line - find the problem using the important rule then fix it using specificity.
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment