Previous Message
Next Message

RE: [css-d] Multiple style sheets only working with @import placed last

Sent by Sauyet, Scott (OTS-HAR) on 26 September 2002 16:04


> = Ian Hickson [EMAIL-REMOVED]>
>> = Scott Sauyet [EMAIL-REMOVED]>

>>  		<style ...>
>>  			p {color: red}
>>  			@import "next.css"
>>  		</style>
> 
> That is, for the record, invalid. @import rules must come before any
> declarations.

Oops, that's right.  It is.  From [1] we can read "Any @import rules must 
precede all rule sets in a style sheet."  The validator [2] does catch
this, reporting a parse error.

Mozilla 1.1 and Opera 6.01 properly ignore an @import after other rules.
IE6-win does not.  I put together two simple tests at
http://tinyurl.com/1nga 
and http://tinyurl.com/1ngb.

In the first, the @import comes before other rules, and all three tested
browsers work correctly.  In the second, the @import comes afterwards, and
IE6-win overrides it with other rules in the stylesheet.  But for rules
which are not overridden, it does use the ones from the @import-ed sheet.
All tests were on Win2K Pro.

I hope I've made up for the bad info.

  -- Scott Sauyet

[1] http://www.w3.org/TR/REC-CSS2/cascade.html#at-import
[2] http://jigsaw.w3.org/css-validator/
Previous Message
Next Message

Possibly related: