How can I apply the rules below to IE only?

Apply CSS Rules to IE only

There are 2 ways to do so. One like below

<!--[if IE]>
<style type="text/css">
  IE specific CSS rules go here
</style>
<![endif]-->


And second one like to avoid loading multiple CSS files or to have inline CSS is to hand a class to the body tag depending on the version of Internet Explorer.

<!--[if IE ]><body class="ie"><![endif]-->
<!--[if !IE]>--><body><!--<![endif]-->

Now in your css code, you can simply do:

.ie .abc {
  position:absolute;
  left:30;
  top:-10;
}

Leave a comment