Skip to main content

!important forces the statement to always apply, doing these things:

  • even if the selector is less specific and lower level, it now beats higher specificity selectors
  • if there are further occurrences of that statement that would normally override that one, it does not override the important statement any more

Most of the time, !important can be avoided because specificity of selectors handles which one takes effect, which is the idea of cascading styles. However, there are some situations (can't quite remember the exact one) where the specificity isn't that logical and I have to force !important on the statement.

Reasons not to use/avoid !important?

  • prevents users from using custom stylesheets (which now can't override the rules that are marked as important) which breaks accessibility for some people
  • makes code more difficult to read because the mind normally takes specificity quite easily, but remembering what is !important makes it harder to read
  • lacks full IE support before version 7 (I don't care about IE, but you may)

!important forces the statement to always apply, doing these things:

  • even if the selector is less specific and lower level, it now beats higher specificity selectors
  • if there are further occurrences of that statement that would normally override that one, it does not override the important statement any more

Most of the time, !important can be avoided because specificity of selectors handles which one takes effect, which is the idea of cascading styles. However, there are some situations (can't quite remember the exact one) where the specificity isn't that logical and I have to force !important on the statement.

Reasons not to use/avoid !important?

  • prevents users from using custom stylesheets (which now can't override the rules that are marked as important) which breaks accessibility for some people
  • makes code more difficult to read because the mind normally takes specificity quite easily, but remembering what is !important makes it harder to read
  • lacks full IE support before version 7 (I don't care about IE, but you may)

!important forces the statement to always apply, doing these things:

  • even if the selector is less specific and lower level, it now beats higher specificity selectors
  • if there are further occurrences of that statement that would normally override that one, it does not override the important statement any more

Most of the time, !important can be avoided because specificity of selectors handles which one takes effect, which is the idea of cascading styles. However, there are some situations (can't quite remember the exact one) where the specificity isn't that logical and I have to force !important on the statement.

Reasons not to use/avoid !important?

  • prevents users from using custom stylesheets (which now can't override the rules that are marked as important) which breaks accessibility for some people
  • makes code more difficult to read because the mind normally takes specificity quite easily, but remembering what is !important makes it harder to read
added 5 characters in body
Source Link
Delan Azabani
  • 81.8k
  • 30
  • 174
  • 216

!important forces the statement to always apply, doing these things:

  • even if the selector is less specific and lower level, it now beats higher specificity selectors
  • if there are further occurrences of that statement that would normally override that one, it does not override the important statement any more

Most of the time, !important can be avoided because specificity of selectors handles which one takes effect, which is the idea of cascading styles. However, there are some situations (can't quite remember the exact one) where the specificity isn't that logical and I have to force !important on the statement.

Reasons not to use/avoid !important?

  • prevents users from using custom stylesheets (which now can't override the rules that are marked as important) which breaks accessibility for some people
  • makes code more difficult to read because the mind normally takes specificity quite easily, but remembering what is !important makes it harder to read
  • lacks full IE support before version 87 (I don't care about IE, but you may)

!important forces the statement to always apply, doing these things:

  • even if the selector is less specific and lower level, it now beats higher specificity selectors
  • if there are further occurrences of that statement that would normally override that one, it does not override the important statement any more

Most of the time, !important can be avoided because specificity of selectors handles which one takes effect, which is the idea of cascading styles. However, there are some situations (can't quite remember the exact one) where the specificity isn't that logical and I have to force !important on the statement.

Reasons not to use/avoid !important?

  • prevents users from using custom stylesheets (which now can't override the rules that are marked as important) which breaks accessibility for some people
  • makes code more difficult to read because the mind normally takes specificity quite easily, but remembering what is !important makes it harder to read
  • lacks IE support before version 8 (I don't care about IE, but you may)

!important forces the statement to always apply, doing these things:

  • even if the selector is less specific and lower level, it now beats higher specificity selectors
  • if there are further occurrences of that statement that would normally override that one, it does not override the important statement any more

Most of the time, !important can be avoided because specificity of selectors handles which one takes effect, which is the idea of cascading styles. However, there are some situations (can't quite remember the exact one) where the specificity isn't that logical and I have to force !important on the statement.

Reasons not to use/avoid !important?

  • prevents users from using custom stylesheets (which now can't override the rules that are marked as important) which breaks accessibility for some people
  • makes code more difficult to read because the mind normally takes specificity quite easily, but remembering what is !important makes it harder to read
  • lacks full IE support before version 7 (I don't care about IE, but you may)
added 179 characters in body; added 81 characters in body
Source Link
Delan Azabani
  • 81.8k
  • 30
  • 174
  • 216

!important forces the statement to always apply, doing these things:

  • even if the selector is less specific and lower level, it now beats higher specificity selectors
  • if there are further occurrences of that statement that would normally override that one, it does not override the important statement any more

Most of the time, !important can be avoided because specificity of selectors handles which one takes effect, which is the idea of cascading styles. However, there are some situations (can't quite remember the exact one) where the specificity isn't that logical and I have to force !important on the statement.

However, it is perfectly safeReasons not to use.

If you care about IE support (I don't) please take note that the keyword only works since IE 8, and not earlier versions/avoid (or IE8's IE7-emulating compatibility mode).!important?

  • prevents users from using custom stylesheets (which now can't override the rules that are marked as important) which breaks accessibility for some people
  • makes code more difficult to read because the mind normally takes specificity quite easily, but remembering what is !important makes it harder to read
  • lacks IE support before version 8 (I don't care about IE, but you may)

!important forces the statement to always apply, doing these things:

  • even if the selector is less specific and lower level, it now beats higher specificity selectors
  • if there are further occurrences of that statement that would normally override that one, it does not override the important statement any more

Most of the time, !important can be avoided because specificity of selectors handles which one takes effect. However, there are some situations (can't quite remember the exact one) where the specificity isn't that logical and I have to force !important on the statement.

However, it is perfectly safe to use.

If you care about IE support (I don't) please take note that the keyword only works since IE 8, and not earlier versions (or IE8's IE7-emulating compatibility mode).

!important forces the statement to always apply, doing these things:

  • even if the selector is less specific and lower level, it now beats higher specificity selectors
  • if there are further occurrences of that statement that would normally override that one, it does not override the important statement any more

Most of the time, !important can be avoided because specificity of selectors handles which one takes effect, which is the idea of cascading styles. However, there are some situations (can't quite remember the exact one) where the specificity isn't that logical and I have to force !important on the statement.

Reasons not to use/avoid !important?

  • prevents users from using custom stylesheets (which now can't override the rules that are marked as important) which breaks accessibility for some people
  • makes code more difficult to read because the mind normally takes specificity quite easily, but remembering what is !important makes it harder to read
  • lacks IE support before version 8 (I don't care about IE, but you may)
Source Link
Delan Azabani
  • 81.8k
  • 30
  • 174
  • 216
Loading