Previous Message
Next Message

Selector order/weighting confusion

Sent by John Lewis on 27 January 2005 15:03


On Thu, 27 Jan 2005 21:42:35 +1000, jack fredricks [EMAIL-REMOVED]>  
wrote:

> nice. Any idea on browsers support for this?

!important seems well supported. I know of one IE/Win bug: When an  
!important declaration is followed by a normal declaration of the same  
property (in a single rule), IE acts like the !important declaration isn't  
there.

	span { background: green !important; background: red; }

The background should be green, but it is red in IE/Win. IE ignores the  
first declaration. That means some weird things happen. Given this CSS:

	span { background: green !important; background: red; }
	span#bleh { background: blue; }

The order of declarations, from weakest to strongest:
	red
	blue
	green

The element should be green, but the element will be blue in IE/Win.  
However, the bug only occurs in a single rule. If our CSS was written like  
so:

	span { background: green !important; }
	span { background: red; }
	span#bleh { background: blue; }

IE/Win correctly makes the background green.

-- 
John Lewis
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: