7

How can I make a specific CSS stylesheet for Internet Explorer 8?

I mean, how can I load it only if the browser is IE8? (And not IE7 and IE6)

Smi
  • 13,850
  • 9
  • 56
  • 64
aneuryzm
  • 63,052
  • 100
  • 273
  • 488

3 Answers3

10

use this

<!--[if IE 8]>
<link href="/stylesheets/iestyle8.css" rel="stylesheet" type="text/css" />
<![endif]--> 
red-X
  • 5,108
  • 1
  • 25
  • 38
8
<!--[if IE 8]>
<link href="ie8.css" rel="stylesheet" type="text/css" />
<![endif]-->

http://www.quirksmode.org/css/condcom.html

meo
  • 30,872
  • 17
  • 87
  • 123
  • +1 for bothering to at least give the OP a link to more information (although just linking, rather than just a bit of text, isn't great form). – T.J. Crowder May 08 '10 at 16:11
  • 2
    @Patrick: If you really want **just** IE8, the above is fine. If you want IE8 *and later* (e.g., because you're using something new that will be continued in IE9, which isn't that far away), use `if gte IE 8` instead -- the difference is the `gte`, which is (of course) "greater than or equal". – T.J. Crowder May 08 '10 at 16:12
5

You can use the following:

<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="ie8.css" media="screen" />
<![endif]-->
John McCollum
  • 5,162
  • 4
  • 34
  • 50