RE: @import

On Mon, 30 Jun 2003, David Balch wrote:

> It's worth bearing in mind that this is is illegal in CSS2 (at least in my
> understanding).

Exactly _what_ is illegal?

The specification says that @import, if present, must appear first in a
style sheet. What's the problem with that? You can have an @import and
then those rules that don't need to be protected from "old browsers" (that
spells Netscape 4, doesn't it?). Using a different order would be rather
pointless, since it would violate the specifications and protect the rules
from _conforming_ browsers!

Naturally this means that the style sheets need to be designed taking into
account that other things being equal, declarations in the @import'ed
style sheet will "lose" to declarations in the importing style sheet.
So when needed, make sure other things aren't equal, e.g. by using more
specific selectors. (Or even !important.)

Regarding the development of the CSS specifications, the topic of this
list, I might raise the question whether the restriction of putting
@import first should be removed. Is there any _logical_ reason to it? If
not, hopefully the technical issues could be settled down. CSS is
difficult and confusing by its very nature; it shouldn't be made even
harder by imposing arbitrary, hard-to-remember restrictions.

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/

Received on Monday, 30 June 2003 07:21:37 UTC