Possible Duplicate:
How do I do IE conditionals in CSS?
How can I apply the rules below to IE only?
.abc { float:left; height:0; margin:0 10px; width:0; /*Apply these rules for IE only*/ position:absolute; left:30; top:-10; /*Apply these rules for IE only*/ }
When working with HTML and CSS, it is common to face browser-specific issues for the same web application. Therefore, it becomes necessary to develop browser-specific CSS code to assure a seamless user experience, regardless of the browser they use. CSS Grid: CSS Grid is widely used in web design.
In browsers up to and including IE9, this is done through conditional comments.
<!--[if IE]> <style type="text/css"> IE specific CSS rules go here </style> <![endif]-->
A good way 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 you only need general IE hacks, you can do something like this, but it can be extended to be version specific:
<!--[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; }
This also keeps your CSS files valid, as you do not have to use dirty (and invalid) CSS hacks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With