Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>hmm... !important or !!important? </p> <p>Let's go through this step by step:</p> <ol> <li>The Parser has to check for !important for each property, regardless of whether you use it or not - so performance difference here is 0</li> <li>When overwriting a property, the parser has to check whether the property being overwritten is !important or not - so performance difference here is 0 again</li> <li>If the property being overwritten is !!important, it has to overwrite the property - performance hit of -1 for not using !important</li> <li>If the property being overwritten is !important, it skips overwriting the property - performance boost of +1 for using !important</li> <li>If the new property is !important, the parse has to overwrite it regardless of the property being overwritten is !important or !!important - performance difference 0 again</li> </ol> <p><strong>So I guess !important actually has better performance as it can help parser skip many properties that it won't skip otherwise.</strong></p> <p>and as @ryan mentions below, the only way to override inline css and avoid using javascript... so another way to avoid an unnecessary performance hit</p> <p>hmm... turns out out that !important is important</p> <p>and also, </p> <ul> <li>using !important saves a lot of time for a developer</li> <li>sometimes saves you from redesigning the whole css</li> <li>sometimes html or the parent css file is not in your control, so it saves your life there</li> <li>obviously prevents !important elements from being accidentally overwritten by other !!important elements</li> <li>and sometimes browsers just don't pick the right properties, without being too specific in selectors, so using !important really becomes important and saves you from writing tonnes of specific css selectors in your css. so i guess even if you use more bytes for writing !important, it could save you bytes in other places. and we all know, css selectors can get messy.</li> </ul> <p><strong>So I guess using !important can make developers happy, and I think that's very important</strong> :D</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload