Correct use of !important

The !important property in CSS is used to provide more weight (importance) than normal property. In CSS, the !important means that “this is important”, ignore all the subsequent rules, and apply !important rule and the !important keyword must be placed at the end of the line, immediately before the semicolon.

  • In other words, it adds importance to all the sub-properties that the shorthand property represents.
  • In normal use, a rule defined in an external style sheet which is overruled by a style defined in the head of the document, which in turn, is overruled by an inline style within the element itself (assuming equal specificity of the selectors).
  • Defining a rule with the !important attribute that discards the normal concerns as regards the later rule overriding the earlier ones.
  • So, it is used for overriding the styles that are previously declared in other style sources, in order to achieve a certain design.