Saturday 15 December 2012

Css fix for IE

CSS Specific for Internet Explorer

IE conditional comment is probably the most commonly used to fix the IE bugs for specific versions (IE6, IE7, IE8, IE9). Below are some sample code to target different versions of Internet Explorer:

<!--[if lt IE 8]> = IE7 or below

<!--[if IE 8]> = IE8

<!--[if gte IE 8]> = greater than or equal to IE8

<!--[if IE 9 ]> = IE9

<!--[if gt IE 9]> = greater than or equal to IE9


Here is the an example of including the styles for each version of IE

<!--[if lt IE 8]> 
<link href="ie7.css" rel="stylesheet" type="text/css" /> /* css for IE7 */
<![endif]-->

<!--[if gte IE 8]>
<link href="ie8.css" rel="stylesheet" type="text/css" /> /* css for IE8 & greater*/
<![endif]-->

<!--[if IE 9 ]>
<link href="ie9.css" rel="stylesheet" type="text/css" /> /* css for IE9 */
<![endif]-->

<!--[if gt IE 9]>
<link href="ie9.css" rel="stylesheet" type="text/css" /> /* css for IE9 & greater */
<![endif]-->


Hope this helps!

No comments:

Post a Comment