1. Computing

Discuss in my forum

Jennifer Kyrnin

Poll: Do you use the CSS !important property?

By November 29, 2012

Follow me on:

One of the reasons many people don't like CSS is because it can sometimes be difficult to figure out why a property is or is not being applied. The cascade is typically the reason for this, but that doesn't help you when you're fighting with a complicated site and can't get the style to work. But there is a way to force your styles no matter what the rest of the style sheet says: the !important marker. To use it, you just put it at the end of any style call that you want to override everything else. For example:

p { color: red !important; }
p { color: black; }

This will turn all paragraphs red, even though the second style would turn them all back to black.

Learn More: What does !important mean in CSS?

Get More Help with CSS

No comments yet. Leave a Comment
Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

©2014 About.com. All rights reserved.