Layout
HTMLNavigation
Website navigationGraphics
GraphicsScripts
Dynamic web pagesIf you are using CSS to control the layout of your web pages you may need to use a script to feed different CSS stylesheets to different browsers.
Here is some sample code you can use to detect a visitor's browser and serve them the correct style sheet. You need to copy the following line into the HEAD section of your web pages:
and then save the following as a file called detect.js and place it in the same directory as your web pages.
The above code detects what browser version is being used and creates a line that will include the correct stylesheet. In this case I have created 4 stylesheets, one for Internet Explorer, one for Mozilla, one for the Apple Mac and one for IE on the Mac. This script is currently working on this site however it probably needs updating.
Of course you also have to create the stylesheets that are being "called" above for this script to work. The names of these stylesheets are:
ie5mac.css
macdefault.css
ie.css
mozilla.css
Next let us create a stylesheet which will work in most browsers.