IE7 has fixed many bugs and added support for some separators, therefore, hack for IE hiding or display, such as * html {} and html> body {}, will expire in IE7. Although CSS Hack is not recommended, it is a foolproof filter, but it can only appear in HTML, and CSS Hack is useful. Nanobot found some CSS Hack for IE7, specifically:
> Body
Html *
* + Html
The first two are invalid CSS statements, which are ignored in standard compatible browsers, but not in IE7. For> body, it will replace the missing selector with the global selector *, that is, it will be processed as *> body, and not only for> selector, + ,~ This phenomenon also exists in the selector. For html *, because there is no space between html and *, it is also a CSS syntax error, but IE7 does not ignore it, but mistakenly considers there is a space here. For the third type of * + html, IE7 considers that the DTD declaration before html is also an element, so html will be selected. Among the three methods, only this method is legal CSS Writing, that is to say, it can be verified by the validator, so it is also the hack usage recommended by the author.
Finally, the author provides the best method:
IE 6 and below
Use * html {} to select the html element.
IE 7 and below
Use * + html, * html {} to select the html element.
IE 7 only
Use * + html {} to select the html element.
IE 7 and modern browsers only
Use html> body {} to select the body element.
Modern browsers only (not IE 7)
Use html>/**/body {} to select the body element.
For more information, see the original article: Easy CSS hacks for IE7.