Previous Message
Next Message

Pros and Cons of JavaScript vs. @Import

Sent by Zoe M. Gillenwater on 9 August 2004 13:01


Dean Matsueda wrote:

>The only time I use the @import declaration is to hide a stylesheet from Netscape 4.x.  But to be
honest, I really don't do that anymore.  For earlier browsers, I just don't worry about
presentation... I just try to make sure that page content is accessible and readable as best as I
can to users of these browsers.
>  
>

You seem to be contradicting yourself here.  If all you care about in v4 
browsers is accessible and readable content, the best way to do this is 
to hide your style sheet from them via @import.  If you use <link> 
instead, v4 browsers will try to render your styles, often with 
disasterous results.

I usually have to have *some* styling for NN4.x, so I feed them their 
own style sheet via Al Sparber's excellent Javascript method and @import 
the other style sheet for all modern browsers.  This method does *not* 
fail if the user has Javascript disabled: in NN4, CSS and Javascript are 
tied together, so if they have Javascript disabled they are not going to 
get any styles anyway.  I really like this method because I don't have 
to worry about rules conflicting in my two style sheets.

Other than this, though, don't mess with browser detection.  It's not 
reliable enough, and can make things very hard to maintain.  I use hacks 
when necessary to customize select rules for specific browsers.

Zoe

-- 
Zoe M. Gillenwater
Design Specialist
Highway Safety Research Center
http://www.hsrc.unc.edu

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread:

Possibly related: