Previous Message
Next Message

Re: [css-d] Proper Use of @import

Sent by B.K. DeLong on 31 January 2002 11:11

At 08:17 AM 01/31/2002 -0500, you wrote:
>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.

I just joined the list this morning, so I'm a little late. Can you list the 
links to these messages from the archives? 

>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."

(Others can read the recommendation here:

And what you reference above is not entirely true. The recommendation says:

"So that user agents can avoid retrieving resources for unsupported media 
types, authors may specify media-dependent @import rules. These conditional 
imports specify comma-separated media types after the URI. "

The pertinent part of what @import is for is "The '@import' rule allows 
users to import style rules from other style sheets."

And frankly, I agree. Though I'll reserve specific judgement until I read 
the notes that say using @import to hide styles from NN4 is incorrect 
usage.....I have to say that I am disappointed.

Here many of us have been trying to find a solution to create accessible, 
(X)HTML + CSS sites that don't use tables for layout or JavaScript to 
perform browser sniffing and stylesheet assignment, and it looks like we've 
found the best solution in @import. It's NOT a hack, it's not a workaround 
- it's a correct, accessible implementation of CSS; period. Whether that 
was @import's original purpose or not, it's still valid use of the standard.

As I mentioned previously, I have not seen the messages saying this is 
improper use of @import so I apologize if my diatribe went overboard. 
Nonetheless, I for one will continue to recommend using @import to create 
sites without tables, font elements, and align attributes.

B.K. DeLong
617.877.3271               Play.        Potter.                       Security.     Herb.
Previous Message
Next Message

Message thread:

Possibly related: