CSS Hacks for CSS Developer
November 13, 2007I've found this CSS hacks from javascriptkit.com. I hope you will find it helpful.
Most in-CSS hacks deal with selector bugs. The following is a list of browser version ranges and the beginnings of selectors that are known to select elements in them. Note that because these hacks rely on browser bugs or missing features, results may vary in some lesser-known or future browsers. All of these selectors use valid CSS.
- IE 6 and below
* html {}- IE 7 and below
*:first-child+html {} * html {}- IE 7 only
*:first-child+html {}- IE 7 and modern browsers only
html>body {}- Modern browsers only (not IE 7)
html>/**/body {}- Recent Opera versions 9 and below
html:first-child {}
Note that the hack for IE 7 and below is actually two separate selectors: one for IE 7 and one for IE 6 and below. The rest of the desired selector must be added to both parts of the hack. The two parts cannot be combined with a comma, because IE 6 and below will fail to correctly parse the selector and won't be targetted.
The above selectors will select either the html or body element. This should be used as the start of your full selector. For example, if your desired selector is #foo .bar and you want it to apply only to IE 7, your resulting selector will be *:first-child+html #foo .bar.


