css priority arrangement

2 views
Skip to first unread message

kelly

unread,
Oct 19, 2011, 7:08:19 AM10/19/11
to Bysoft CMS
please see arrangemet for css priority:
http://html_templates.sarge.com/kelly/templates/csspriority.html
any question please contact me.

Chris

unread,
Oct 19, 2011, 10:51:02 PM10/19/11
to bysof...@googlegroups.com
It's a good article, give you a "+1", LOL.

For additional information, please notice that "!important" only impacts properties (color, background) not selector (IDs, classes), it's different from others.
And always has one value, 1 or 0, so you won't get "2 1 0 0".

The comparison is from left to right, if they knows who is bigger, will ignore the rest.
"1 0 0 0" is always bigger than "0 255 255 255".
Browsers will take the biggest one, except there's a bug.

For example, on IE6:
div { height: 100px!important; height: 40px; }
IE6 will take the second one, 40px.
IE6 will ignore the "!important" in same rule.

This will work as expected:
div { height: 100px!important }
div { height: 40px; }
The result is 100px.
Reply all
Reply to author
Forward
0 new messages