View Full Version : CSS !Important Validation Error

05-23-2008, 04:49 AM

Can anyone tell me why this:

padding:6px !important 15px !important 6px !important 15px !important

doesn't validate?

It's the last line of code, so doesn't need the semi-colon and it is followed by a curly brace.

It's now 4.47 in the morning and I am going crazy trying to see what the problem is!



05-23-2008, 08:16 AM
In css 2.1 candidate recommendation (http://www.w3.org/TR/CSS21/cascade.html#important-rules):
Declaring a shorthand property (e.g., 'background') to be "!important" is equivalent to declaring all of its sub-properties to be "!important

You should write:

padding:6px 15px 6px 15px !important

05-23-2008, 09:07 AM
!important can't be used more than once inside a rule.
You have to write it like

padding:6px 15px 6px15px !important

padding:6px 15px !important
BTW, what's your need to apply a padding like this? There might be some other issues in your CSS/layout, and fixing of this may enable you to remove the above rules.

Could you post a link?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum