-
-
Save stan/074353cfd21e039180b1749c334b3fe9 to your computer and use it in GitHub Desktop.
IE CSS hacks - IE6, 7, 8, 9, 10, 11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IE6 Only | |
================== | |
*html or { _property:... } | |
IE7 Only | |
================== | |
*+html or { *property:... } - Keep in mind that you have to put the IE7 property first within the same selector. | |
IE8 | |
================== | |
.selector/*\**/ { color:#f00; } | |
IE8 and IE9 (TOTALLY NOT NEEDED - I LEFT HERE FOR REFERENCE ONLY) | |
================== | |
.selector { color:#f00\9; } - http://stackoverflow.com/questions/660652/ie8-css-selector | |
The above solution doesn't work with font-family, so instead you need to use "\0/ !important" | |
Example: { font-family:Arial \0/ !important; } | |
http://dimox.net/personal-css-hacks-for-ie6-ie7-ie8/ | |
Also, using "\9" is picked up by IE10 and IE11 so you need to redeclare the CSS rules with "-ms-high-contrast:". See info below. | |
IE9 Only | |
================== | |
:root .class/#id { property:value \0/IE9; } | |
http://blog.vervestudios.co/blog/post/2011/05/13/IE9-Only-CSS-Hack.aspx | |
IE10 Only | |
http://css-tricks.com/ie-10-specific-styles/ | |
================== | |
Use this JavaScript: | |
var doc = document.documentElement; | |
doc.setAttribute('data-useragent', navigator.userAgent); | |
Then use this CSS: | |
html[data-useragent*='MSIE 10.0'] h1 { color: blue; } | |
IE10 and IE11 | |
================== | |
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { | |
.selector { property:value; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment