Skip to content

Instantly share code, notes, and snippets.

@frankyonnetti
Last active May 22, 2021 22:42
Show Gist options
  • Save frankyonnetti/5944678 to your computer and use it in GitHub Desktop.
Save frankyonnetti/5944678 to your computer and use it in GitHub Desktop.
#css IE version targeting hacks 2
/* https://stackoverflow.com/a/27315792 */
/* IE 6 */
* html .ie6 {
property: value;
}
/* or */
.ie6 {
_property: value;
}
/* IE 7 */
*+html .ie7 {
property: value;
}
/* or */
*:first-child + html .ie7 {
property: value;
}
/* IE 6 and 7 */
@media screen\9 {
.ie67 {
property: value;
}
}
/* or */
.ie67 {
*property: value;
}
/* or */
.ie67 {
#property: value;
}
/* IE 6, 7 and 8 */
@media \0screen\,screen\9 {
.ie678 {
property: value;
}
}
/* IE 8 */
html>/**/body .ie8 {
property: value;
}
/* or */
@media \0screen {
.ie8 {
property: value;
}
}
/* IE 8 Standards Mode Only */
.ie8 {
property/*\**/: value\9;
}
/* IE 8, 9 and 10 */
@media screen\0 {
.ie8910 {
property: value;
}
}
/* IE 9 only */
@media screen and (min-width:0\0) and (min-resolution: 0.001dpcm) {
// IE9 CSS
.ie9 {
property: value;
}
}
/* IE 9 and above */
@media screen and (min-width:0\0) and (min-resolution: +72dpi) {
// IE9+ CSS
.ie9up {
property: value;
}
}
/* IE 9 and 10 */
@media screen and (min-width:0) {
.ie910 {
property: value;
}
}
/* IE 10 only */
_:-ms-lang(x),
.ie10 {
property: value\9;
}
/* IE 10 and above */
_:-ms-lang(x),
.ie10up {
property: value;
}
/* or */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
.ie10up {
property: value;
}
}
/* The use of -ms-high-contrast means that MS Edge will not be targeted,
as Edge does not support -ms-high-contrast. */
/* IE 11 */
_:-ms-fullscreen,
:root .ie11up {
property: value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment