Alex Rivera | Logout

How do I detect the user’s browser and apply a specific CSS file?

Asked 2011-04-11T13:04:57.597
25

I need to detect the browser and apply the matched CSS file.

I have created 3 css files: __ie.css, ff.css, opera.css. Now I need to detect the browser in order to include the good one.

I know this

<!--[if IE]>
     <link rel="stylesheet" href="css/ie.css" type="text/css"/>
<![endif]-->

But how do I do the same with Firefox and Opera/Chrome?

Edit
Report

1 Answer

1

There are no conditional comments for browsers other than IE.

But you can do it with javascript: http://www.quirksmode.org/js/detect.html

answered 2011-04-11T13:15:39.457

Your Answer