important i css code example

Example 1: css important

#content ul li {
   color : red;
}

ul li {
   color : blue !important; /* overrides the red color */
}

Example 2: !important css

div {
 width: 100% !important;
}

Example 3: important css

/* The !important property in CSS means that all subsequent rules on
an element are to be ignored, and the rule denoted by !important is
to be applied. This rule overrides all previous styling rules -- the
!important property increases its priority. */
h1 {
  background-color: red !important;  /* Syntax */
}
/* The !important property is mentioned immediately before the semicolon */

Example 4: important css

Hey! Using !important in your code means that you've done something wrong.
Try avoiding it as much as possible.

Tags:

Css Example