<!--[if !IE]--> < link href ="styles.css" rel ="stylesheet" media ="all" /><! -- [ endif ] -- ><!--[if IE 6]><link href="ie6.css" rel="stylesheet" media="all" /><![endif]--><!--[if IE 7]><link href="ie7.css" rel="stylesheet" media="all" /><![endif]--><!--[if IE 8]><link href="ie8.css" rel="stylesheet" media="all" /><![endif]-->* html .class{background:red}If the html page has a doctype, this hack only works for IE6.*+html .class{background:red}or*:first-child+html .class{background:red}In case the html page has a doctype, this hack works in IE7..class{<br>_background:red<br>}.class{<br>-background:red<br>}-,.class{<br>background:red;<br>}.class{<br>*background:red<br>}.class{<br>//background:red;<br>}.class{background:red!ie}Hack, working in IE6 and IE7, by analogy with the! Important property.html*.class{background:red}Nuance - in Google Chrome 2 does not work. Hack comes in handy in general for IE css-file when you need to separate styles from 8-kihtml:root*.class{background:red}Also does not work in Chrome 2. The reason for using such a hack and other hacks for safari can be found here .@-moz-document url-prefix(){<br>.class{background:red}<br>}x:-moz-any-link,.class{background:red}x:-moz-any-link,x:default,.class{background:red}noindex:-o-prefocus,.class{background:red}To turn it into an opera-only hack, use any framing hack that does not support IE7.html:root .class{background:red}@media screen and (-webkit-min-device-pixel-ratio:0) {<br>body:first-of-type .class {background: red}<br>}body:first-of-type .class{background:red}@media all and (min-width:0){<br>.class{background:red}<br>}html:not([lang*=""]):not(:only-child) .class{background:red}This hack can be used for example, if you want to make rounded corners for Safari and FF using CSS , and for other browsers you want to have pictures.<!--[if !IE 6]--> < link href ="styles.css" rel ="stylesheet" media ="all" /><! -- [ endif ] -- >html>body .class{background:red}head+body .class{background:red}html:first-child .class{background:red}html>/**/body .class{background:red}*|html .class{background:red}html:not([lang*=""]) .class{background:red}<!--[if IE]><link href="ie.css" rel="stylesheet" media="all" /><![endif]-->And then further I separate hacks * html and *+html styles for IE6 and IE7, respectively. The remaining styles are obtained for all IE.< meta http-equiv ="X-UA-Compatible" content ="IE=8" />The basic content values ​​are as follows (taken from here ):IE=EmulateIE7Source: https://habr.com/ru/post/62002/
All Articles