Are you tired of seeing your stylesheets code look good on one platform but crappy on another? You can use JavaScript to detect which platform someone is using and then use that information to link to the appropriate stylesheet.

Here's the code that should go in the <HEAD> of your HTML document:

If a JavaScript-aware browser detects a Macintosh, it uses stylemac.css as the linked stylesheet. If not, it uses stylewin.css.

In an ideal world, cascading stylesheets would work so well that this browser detection solution would be unnecessary. But for now, because browsers do look and behave differently across platforms, this might be what you have to resort to.

By the way, if you so desire, you can get more specific and detect particular browsers and browser versions and serve up different stylesheets files for every single one.

Hit your Back button to return to the tutorial.