@import Rule

Home

NN4 does not support @import, so this provides a very handy built-in browser sniffer. It's particularly handy because NN4's css support is where the worst of the buggy quirks live, so this method is often all you need for solid cross-browser styling.

You can use the @import method to reference a local file. Either use "http://etc..." or a relative url like "./file.css".

In the example below the file nn4.css contains a full stylesheet that works in Netscape 4.x. The file generic.css contains only those Netscape 4 specific rules that need to be over-written for other browsers - including NN6.

The code below goes in the <HEAD> section, and the order of the two statements is essential to take advantage of the cascade. That is, the <link> tag MUST come before the <style> tag with the @import.

<link rel=stylesheet href="http://example.com/nn4.css">
<STYLE TYPE="text/css">
  @import url(http://example.com/generic.css);
</STYLE>