Posted By

vagrantradio on 02/16/10


Tagged

css hack ie html browser ie6 hacks internet explorer specific


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

pauloc


IE SPECFIC ALTERNATE STYLESHEETS AND HACKS


 / Published in: CSS
 

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

Got tired of searching for this stuff so I posted it here.

  1. /* BROWSER SPECIFIC ---------------------------------------------------- */
  2. IE ONLY
  3. <!--[if IE]>
  4. <link rel="stylesheet" type="text/css" href="ie-only.css" />
  5. <![endif]-->
  6.  
  7. EVERYTHING BUT IE
  8. <!--[if !IE]>
  9. <link rel="stylesheet" type="text/css" href="not-ie.css" />
  10. <![endif]-->
  11.  
  12. IE 7 ONLY:
  13.  
  14. <!--[if IE 7]>
  15. <link href="IE-7-SPECIFIC.css" rel="stylesheet" type="text/css">
  16. <![endif]-->
  17.  
  18. IE 6 ONLY:
  19.  
  20. <!--[if IE 6]>
  21. <link rel="stylesheet" type="text/css" href="IE-6-SPECIFIC.css" />
  22. <![endif]-->
  23.  
  24. IE 5 ONLY:
  25.  
  26. <!--[if IE 5]>
  27. <link rel="stylesheet" type="text/css" href="IE-5-SPECIFIC.css" />
  28. <![endif]-->
  29.  
  30. IE 5.5 ONLY
  31.  
  32. <!--[if IE 5.5000]>
  33. <link rel="stylesheet" type="text/css" href="IE-55-SPECIFIC.css" />
  34. <![endif]-->
  35.  
  36. VERSION OF IE VERSION 6 OR LOWER
  37.  
  38. <!--[if lt IE 7]>
  39. <link rel="stylesheet" type="text/css" href="IE-6-OR-LOWER-SPECIFIC.css" />
  40. <![endif]-->
  41.  
  42. VERSION OF IE VERSION HIGHER THAN 6
  43.  
  44. <!--[if gt IE 6]>
  45. <link rel="stylesheet" type="text/css" href="IE-HIGHER-THAN-6-SPECIFIC.css" />
  46. <![endif]-->
  47.  
  48. /* Hacks --------------------------------------------------------------------------- */
  49. IE-7 ONLY:
  50.  
  51. * html #div {
  52. height: 300px;
  53. }
  54.  
  55. NON IE-7 ONLY:
  56.  
  57. #div {
  58. _height: 300px;
  59. }
  60.  
  61. HIDE FROM IE 6 AND LOWER:
  62.  
  63. #div {
  64. height/**/: 300px;
  65. }
  66.  
  67. HIDE FROM IE 6 AND LOWER: (another way)
  68.  
  69. html > body #div {
  70. height: 300px;
  71. }

Report this snippet  

You need to login to post a comment.