649pages on
this wiki
Add New Page
Comments0 Share

The CSS !important declaration is used to specify which style to rule. Property values with this declaration following them will override other existing property values of similar effect.


<style type="text/css">
    p { 
       color:green !important;
<p style="color:red;">This text will be green.</p>

Normally the color of the text would be red, because inline styles override the rules set in a <style> element. By including the !important declaration in the style rule, you set the content of the paragraph to green.

More examples:

In a CSS file...
h1 {
    color:white !important;
In the HTML file...
   <link rel="stylesheet" type="text/css" href="CSS.css" />
   <h1 style="
     color:orange !important;

The text in the first heading will be orange, even though the CSS specified it as white with the important declaration, because the orange color in the <h1> element itself is marked with the important declaration, resulting in orange text instead of white text.

External Links

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.