Showing posts with label IE. Show all posts
Showing posts with label IE. Show all posts

CSS hacks that you can use for Internet Explorer

To target Internet Explorer (IE) versions 6 and below, you can use the * html hack:

* html {

  /* Your IE-specific styles go here */

}

To target only IE7, you can use the *+html hack:

*+html {

  /* Your IE7-specific styles go here */

}

To target only IE8, you can use the \9 hack:

.some-class {

  color: blue;

  /* All other browsers */

  color: red \9;

  /* IE8 and below */

}

To target only IE9, you can use the @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) hack:

@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {

  /* Your IE9-specific styles go here */

}

Note: These CSS hacks are specific to Internet Explorer and are not supported by other browsers. It's generally better to use feature detection and use modern, standards-compliant techniques instead of relying on hacks like these. 

Posted in