How to write IE specific CSS to the same CSS file.

Sometimes we are facing issue with IE browsers, specially after introduce of CSS3 properties. In that case we need some IE specific css code to be written.
Generally what we are doing, we are writing one separate css file and including the file in header specially for IE like the following code.


Or we are writing some hack to the CSS codes like this.

* html #div { 
    height: 300px;
}

*+html #div { 
    height: 300px;
}
#div {
   _height: 300px;
}
#div {
   height/**/: 300px;
}

But if we will get one separate class name in the body tag specially for IE browser, then we can easily manage the IE specific CSS code to that single CSS file by taking the parent class as the body class. Which will executes only for IE browsers.
The following HTML code will help you to write a separate css class to body specially for IE browsers.



   

Keep Coding enjoy CSS !!!!

Leave a Reply

Your email address will not be published. Required fields are marked *