Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q5408 What is the !important CSS rule?

You are here: irt.org | FAQ | CSS | Q5408 [ previous next ]

CSS tries to create a balance of power between author and user style sheets. By default, rules in an author's style sheet override those in a user's style sheet.

However, for balance, an "!important" declaration takes precedence over a normal declaration. Both author and user style sheets can contain "!important" rules, but user "!important" rules override author "!important" rules.

Note: In CSS1, it works the other way: Author "!important" rules took precedence over user "!important" rules.

If you, in your style sheet want to mark something as important, use the following code:

P { font-size: 18pt ! important }

You are telling your user, that it is important, that you use 18pt, as your fontsize.

©2018 Martin Webb