[thelist] import style sheet

Mark Howells mark at mountain.ch
Fri Mar 8 12:37:01 CST 2002

>> Can anyone point me to a resource that explains clearly
>> how the @import system of referencing style sheets
>> works?
> you can place the following within a <style> block or
> within an external stylesheet.
> @import: url(../styles/import.css);
> @import: url('/styles/import.css');
> @import: url("styles/import.css");

Note that not all of the syntax methods above work in all browsers. IE4 and
Opera, in particular, choke on some of them and so you'll need to make sure
you use one that works across all browsers.

The one that I use is

@import "/common/css/cooper.css";

which only fails in NN4 and IE4 (the latter of which isn't a problem as my
code structure is laid out so that it renders neatly and legibly with no CSS
at all).

In answer to the original question, the reason that this method is used to
avoid layout problems in NN4 is that the browser doesn't understand the
@import command and so it ignores the content of the file. Think of @import
as a "CSS include file" any you won't go far wrong.

Mark Howells

More information about the thelist mailing list