homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe and Support WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: DrDoc

CSS Forum

Using @import to give Netscape 4 its own CSS

 7:04 am on Aug 17, 2001 (gmt 0)

Many web developers have avoided the @import technique for stylesheets because Netscape 4.x did not support it. I've recently understood that this can be an advantage in dealing with the CSS bugs and quirks in Netscape 4.

Here's a neat trick from the O'Reilly CSS book:

First, create the stylesheet that you want Netscape 4 to use and write the standard <link> tag into the HEAD section of the HTML to bring it in. Then create the stylesheet that you want all the more compliant browsers to use (like Netscape 6, MSIE, Opera).

Bring this stylesheet in AFTER the first one, and use the @import method either @import "stylesheet2.css" or @import url("stylesheet2.css") - NOT another <link> tag.

The more compliant browsers will get the second set of styles, since the cascade will "overwrite" the first, linked stylesheet. Because Netscape 4.x doesn't support @import, it gets only the first set of rules. So, @import works like a browser sniffer that zeros in on the buggiest browsers!



 10:44 am on Aug 17, 2001 (gmt 0)

works for me...I'm a big fan of the "@import hack" :)

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved