Posted By

thesmu on 07/21/09


Tagged

css ie browser conditional


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

vali29
geekus
janvdm


ie only style sheet


 / Published in: HTML
 

URL: http://css-tricks.com/how-to-create-an-ie-only-stylesheet/

how to link ie only stylesheets and stylesheets by generation of ie

  1. Here is the basic technique for an IE-Only stylesheet:
  2.  
  3. <!--[if IE]>
  4. <link rel="stylesheet" type="text/css" href="ie-only.css" />
  5. <![endif]-->
  6.  
  7. The opposite technique, targeting only NON-IE browsers:
  8.  
  9. <!--[if !IE]>
  10. <link rel="stylesheet" type="text/css" href="not-ie.css" />
  11. <![endif]-->
  12.  
  13. If you need to get down and dirty with specific versions of IE, here are a few examples.
  14.  
  15. IE 7 ONLY:
  16.  
  17. <!--[if IE 7]>
  18. <link href="IE-7-SPECIFIC.css" rel="stylesheet" type="text/css">
  19. <![endif]-->
  20.  
  21. IE 6 ONLY:
  22.  
  23. <!--[if IE 6]>
  24. <link rel="stylesheet" type="text/css" href="IE-6-SPECIFIC.css" />
  25. <![endif]-->
  26.  
  27. IE 5 ONLY:
  28.  
  29. <!--[if IE 5]>
  30. <link rel="stylesheet" type="text/css" href="IE-5-SPECIFIC.css" />
  31. <![endif]-->
  32.  
  33. IE 5.5 ONLY:
  34.  
  35. <!--[if IE 5.5000]>
  36. <link rel="stylesheet" type="text/css" href="IE-55-SPECIFIC.css" />
  37. <![endif]-->
  38.  
  39. VERSION OF IE VERSION 6 OR LOWER: (I find this one pretty handy)
  40.  
  41. <!--[if lt IE 7]>
  42. <link rel="stylesheet" type="text/css" href="IE-6-OR-LOWER-SPECIFIC.css" />
  43. <![endif]-->

Report this snippet  

You need to login to post a comment.