!important html code example
Example 1: css important
#content ul li {
color : red;
}
ul li {
color : blue !important; /* overrides the red color */
}
Example 2: important css
body{
font-family: verdana, arial !important;
}
Example 3: !important css
div {
width: 100% !important;
}
Example 4: !important in css
/*
Applying css property to an element is like latest or last added css file styling will override all the design of HTML element.
for e.g.
added three css file in html document line by line
<link rel="" href="stylesheet1.css">
<link rel="" href="stylesheet2.css">
<link rel="" href="stylesheet3.css">
so from above file adding stylesheet3.css will override all duplicate styling.
and if you want to more priorities your css then add inline css.
But in critical sitution like if we don't want override any sytling of an specific element.
then we use !important in css property value.
!important is always on highest priority it works like styling that sticks to any element and never going to removed unless you remove !important from css property value.
*/
Syntax:
div {
width: 100% !important;
}
/*
I hope that above description about !important in css will help you.
Namaste
*/
Example 5: css !important
min-width: 100% !important;
Example 6: important css
Hey! Using !important in your code means that you've done something wrong.
Try avoiding it as much as possible.