Welcome to WebmasterWorld Guest from 54.234.63.187

Forum Moderators: not2easy

Message Too Old, No Replies

Using @import to give Netscape 4 its own CSS

     

tedster

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

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



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

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

WebmasterWorld Senior Member 10+ Year Member



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

Featured Threads

Hot Threads This Week

Hot Threads This Month