[thelist] CSS: question about @import

Mark Gallagher mark at cyberfuddle.com
Fri Jul 26 20:34:01 CDT 2002

Chris W. Parker wrote:
> as far as i know it's recommended to use the @import command to hide
> advanced css from older browsers, i.e. nn4.x.
> i haven't heard anything about WHY i need to hide it from older
> browsers. i'm guessing that the older browser could get even more
> screwed up when it comes across advanced css. if this is not the case,
> won't the older browser(s) just skip over the css it does not
> understand?

No, and that's the problem.

NN3.x is a wonderful browser, and it doesn't understand one whit of CSS.
  NN4.x is a crappy browser, and it pretends to understand a lot of CSS
(but doesn't).  There's other reasons for NN4.x's "quality slide", but
this is a major one.

NN4, IE3, and IE4 all understand some CSS1, no CSS2, and buggers quite a
lot of both CSS1 and CSS2.  Some CSS2 can even crash Netscape.

> also, when you import an advanced stylesheet, does it override
> everything in the primitive stylesheet? or does it just add-on to it?

Adds on to it.

> in conclusion, please point out WHY i need to seperate the two, or why
> it doesn't matter. (i.e. i can stick everything in one css file and let
> the browser deal with it.)

If you don't separate the two, you're faced with two choices: use
@import, or don't.

If you don't use @import, IE3-4 and NN4 will try to render some things
that they really shouldn't be allowed to :-), but they'll see some of
the basic stuff.  You do *do* use it, then IE3-4 and NN4 will get no
styles whatsoever.

Using both means that IE3-4 and NN4 will get some styling, but not the
stuff that'll cause them to crash out.

Obviously, browsers older than IE3-4 and NN4 (not to mention Lynx,
Links, w3m, Dillo, and other modern browsers specifically designed
without support for CSS) won't see styles no matter what :-).

Mark Gallagher

More information about the thelist mailing list