Welcome to WebmasterWorld Guest from 54.242.83.92

Forum Moderators: not2easy

Message Too Old, No Replies

Using @import to give Netscape 4 its own CSS

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

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 6, 2001
posts:917
votes: 0


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

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members