!important Declaration

Internet Development Index

Increases the weight or importance of a particular rule.

Syntax

HTMLsRule!important  }
ScriptingN/A

Possible Values

sRuleAny CSS attribute/value pair.

Example

The following example includes the !important declaration in the style rule. Normally the color of the text would be green, because inline styles override the rules set in a style tag. By including the !important declaration in the style rule, you set the content of the paragraph to red.

<STYLE>
P { color:red!important }
</STYLE>
<P STYLE="color:green">This text will be red.</P>
This feature requires Microsoft® Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Standards Information

This declaration is defined in Cascading Style Sheets (CSS), Level 1 (CSS1) Non-Microsoft link.

Applies To

A, ADDRESS, B, BIG, BLOCKQUOTE, BODY, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, DD, DFN, DIR, DIV, DL, DT, EM, FORM, hn, HTML, I, IMG, INPUT, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MENU, OL, P, PLAINTEXT, PRE, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP