What is the !important CSS rule?

October 26, 2005 | In Developer

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.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Pownce
  • Technorati
  • YahooMyWeb

No Comments yet

Sorry, the comment form is closed at this time.

© 2008 Martin Crockett. Sitemap. RSS Entries and comments feeds. Valid XHTML and CSS. ^Top^