Conditional Statement add css in them

51 views Asked by At

Is it possible to do the following with conditional comments:

<!--[if IE]>
   .ie-only{margin-top:-13px;}
<![endif]-->
1

There are 1 answers

3
Sankar On BEST ANSWER

You can do like this...

<html>

<head>
  <!--[if IE]>
  <style>
    .box {  
        width: 500px;  
        background:red;
        padding: 100px 0;  
      }  
  </style>
<![endif]-->
</head>

<body>
  <div class="box">Try this in IE</div>
</body>

</html>

EDIT:

You can also include external css for IE alone.

<!--[if IE]>
    <link rel="stylesheet" type="text/css" href="onlyfoie.css" />
<![endif]-->