Thursday, January 24, 2013

CSS and HTML Hacks for IE Browsers

IE 6 and below
* html {  } 
IE 7 and below
*:first-child+html {  } * html {  } 
IE 7 only
*:first-child+html {  } 
IE 7 and modern browsers only
html>body {  } 
Modern browsers only (not IE 7)
html>/**/body {  }
Recent Opera versions 9 and below
html:first-child {  }

  1. Internet Explorer 7 and below ignore the additional punctuate and apply the property as if it just had the !important   identifier.
  2. IE8 or below: to write CSS rules specificially to IE8 or below, add a backslash and 9 (\9) at the end before the semicolon.
  3. IE7 or below: add an asterisk (*) before the CSS property.
  4. IE6: add an underscore (_) before the property.

.wrapper {


 background:  red;    /* standard */

background:   red \9;   /* IE 8 and below */

*background:  red ;   /* IE 7 and below */

_background:  red ;   /* IE 6 */

}



html>body #wrapper {

  width: 980px;   /* ..or this reinforcement of the standards width. */

}



IE                     Any version of IE
lt IE                  Version Versions less than version
lte IE version     Versions less than or equal to version
IE version         Only version version
gte IE version    Versions greater than or equal to version
gt IE version     Versions greater than version



Conditional of  HTML links Examples:-

<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
<!--[if IE 7 ]> <html class="ie7"> <![endif]-->
<!--[if IE 8 ]> <html class="ie8"> <![endif]-->
<!--[if IE 9 ]> <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html> <!--<![endif]-->



Conditional of  CSS  links Examples:-

<!--[if IE 8]>
<style type="text/css">
/* css for IE 8 */
</style>

<![endif]-->



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

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

No comments:

Post a Comment