Posted By

Carolyne on 09/22/10


css ie conditional

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Conditional body class

 / Published in: HTML


Allows you to target IE browsers specifically without having to add in an extra http request with another separate stylesheet. Basically, depending on the IE browser that the user is using, a class is added to the body tag. If the user is not using IE, then a classless body tag is used. This allows you to target specific browsers in your css without having to use css hacks, or further stylesheets. Found at the above URL - by Matthew Corner

  1. <!--[if lt IE 7 ]> <body class="ie6"> <![endif]-->
  2. <!--[if IE 7 ]> <body class="ie7"> <![endif]-->
  3. <!--[if IE 8 ]> <body class="ie8"> <![endif]-->
  4. <!--[if IE 9 ]> <body class="ie9"> <![endif<]-->
  5. <!--[if (gt IE 9)|!(IE)]><!--> <!--<![endif]-->

Report this snippet  

You need to login to post a comment.