Sent by Mark Howells on 18 February 2002 12:12
> I wanted to do the @import but never got there. I found a browser
> detection script at
> http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
> and put this on this index page only.
>
> It seems to work correctly!!! Could I have done something easier using
> @import?
@import is most commonly used as a means of detecting Netscape 4 and pre
version 4 browsers, neither of which understand the term and so ignore it
(and the linked stylesheet). Using Javascript to detect the browser in use
is an alternative, but tends to mean a lot of overhead* and problems with
forward compatibility unless it's done properly**.
While you can use Javascript to serve up a browser-specific stylesheet, I'd
recommend that you design your sites and work up your stylesheets so that
only two are required -- one for the "old" browsers (using <link>) and one
for the newer browsers (using @import). This is very achievable if you
accept any minor style differences between browsers.
In short, there's no need to pull in different style sheets for each browser
unless identical appearance is essential.
Regards
Mark Howells
<http://www.mark.ac/css>
* see the size of the source code on the linked page.
** see the section of the linked page entitled "CLASSIC MISTAKE #1 IN CLIENT
DETECTION: FORGETTING ABOUT FUTURE BROWSER VERSIONS".