There are several different methods for browser-specific style sheets:
1) As already mentioned, you can use conditional operators to detect versions of IE, for example.
2) If you use a server language such as PHP, Ruby, etc., you may find a browser based on the HTTP_USER_AGENT server variable, for example.
if(preg_match('/^Mozilla\/.*?Gecko/i',$agent)){ print "Firefox user."; $firefox = true; // process here for firefox browser }
This method is powerful because you can detect almost any browser, and based on this you can include (or print, to be precise) any necessary .css file in your PHP template. For instance.
if ($firefox) print '<link rel="stylesheet" href="http://site.com/firefox.css">';
The advantage of this method is that it happens first of all, even before the page begins to receive a message to the user, and you can accurately determine the version of the browser.
3) And, of course, you can detect the browser version using javascript, it only requires a couple of variables, for example.
var browser=navigator.appName; var b_version=navigator.appVersion; var version=parseFloat(b_version);
But you need to use code that analyzes the values โโof these variables, for example this example .
source share