Hi Mike,

The @import is generally used in two ways (the second is probably what you
are referring to):

-----------------------------------------------
1. import CSS files into other CSS files
-----------------------------------------------
@import can be used to import style sheets into other style sheets. Eg, you
have a corporate stylesheet that is used across an entire site as well as
different style sheets for each section. Each section could import the
corporate style sheet into the top of their style sheets.

WC3 states: Any @import rules must precede all rule sets in a style sheet.
The '@import' keyword must be followed by the URI of the style sheet to
include. A string is also allowed; it will be interpreted as if it had
url(...) around it.
http://www.w3.org/TR/CSS2/cascade.html#at-import

-----------------------------------------------
2. Hide from old browsers
-----------------------------------------------
@import can be used to hide rules (or entires style sheets) from older
browsers. Eg. You can hide rules from Netscape 4 but still allow standards
compliant browsers to see these rules. These are considered hacks, but not
of the evil variety  : )

There are a number of ways to code the @import to hide styles from
particular browsers. Here is a basic rundown (we generally use method "a"):


a. Bracket and quotes
-----------------------------------------------
@import url("../stylesheet.css");
Hides CSS from:
*    Netscape 4.x
*    Win IE 3
*    Win IE 4 (not 4.72)
*    Mac IE 4.01
*    Mac IE 4.5
*    Konqueror 2.1.2
*    Win Amaya 5.1


b. Bracket only
-----------------------------------------------
@import url(../stylesheet.css);
Hides CSS from:
*    Netscape 4.x
*    Win IE 3
*    Win IE 4 (reads css only when located in the same directory as html)
(not 4.72)


c. Bracket and media (I don't like this option)
-----------------------------------------------
@import url(../stylesheet.css) screen;
Hides CSS from:
*    Netscape 4.x
*    Win IE 6 and below


d. Quotes only
-----------------------------------------------
@import "../stylesheet.css";
Hides CSS from:
*    Netscape 4.x
*    Win IE 4 and lower
*    Mac IE 4.01
*    Konqueror 2.1.2


So, the answer to your question "does it matter" - depends on your target
audience and their browsers. Each site will have different needs, users,
etc. so you need to decide before you begin what level of browser support
you will provide. This decision will allow you to decide if @import is
required.

HTH
Russ




> 
> I've noticed that some pages use a link to a style sheet, others use
> @import. 
> 
> What's the difference, and does it matter to developing sites? Or Users?
> 
> Cheers
> Mike Kear
> Windsor, NSW, Australia
> AFP Webworks
> http://afpwebworks.com
> 

*****************************************************
The discussion list for http://webstandardsgroup.org/
***************************************************** 

Reply via email to