Previous Message
Next Message

[css-d] Proper Use of @import

Sent by RUST Randal on 31 January 2002 08:08


I've noticed a couple of people have mentioned that the proper use of
@import is NOT to hide CSS from non-CSS browsers, or those that do not have
broad support for CSS, such as our good friend Netscape 4.

So I wondered what people might have meant, and took a look at the CSS2
Spec.  It says that @import is supposed to be used "So that user agents can
avoid retrieving resources for unsupported media types....In the absence of
any media types, the import is unconditional.  Specifying 'all' for the
medium has the same effect."

In the project that I am working on now, I use "screen" and "print" media
types.  Future versions will need to have alternate style sheets for all of
the other media types.  So I'm following the Spec, but it hides my CSS from
what some of us call "bad browsers."

What I'm thinking is this:  Why doesn't the W3C add another rule, called
@browser?  Then you could set browser-specific style sheets without
Javascript.  IMO, a lot of the W3C specs are moving JS out of the picture
(SMIL, for example).

Is my understanding of @import correct?  Does this make sense, or have I
been thinking too hard?

Randal Rust
Senior Consultant
Covansys, Inc.
Columbus, OH
Previous Message
Next Message

Message thread: