Supporting multiple browsers

From Joomla! Documentation

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

With the gradual evolution of both Cascading Style Sheets (CSS) as a standard and various browser implementations, it is inevitable that style sheets need to be written to cope with various browser incompatibilities. This is particularly true for (the now-deprecated) Microsoft Internet Explorer, but issues can also appear for other browsers. The most frequently used method of handling cross-browser issues is to include an extra browser-specific CSS file in addition to the main CSS file used by the website. This might be specific to a particular class of browsers, for example Internet Explorer or Safari, or it might even be specific to a specific version of a particular browser, for example Internet Explorer version 6 and version 7 may require different style sheets.

The first step in handling browser incompatibilities is browser-detection. How can the type and perhaps the version of the visitor's browser be reliably determined?