homepage Welcome to WebmasterWorld Guest from 54.163.72.86
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

    
Using @import to give Netscape 4 its own CSS
tedster




msg:1219375
 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!

 

Eric_Jarvis




msg:1219376
 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.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved