©
This document uses PHP Chinese website manual Release
E:root { sRules }
根据这个特性,可以做IE8的Hack
示例:
.test {
color: black;
color: yellow\0;
*color: blue;
_color: red;
}
html:root .test {
color: purple\0;
}
上述代码:非IE文本将为black,IE9及以上为purple,IE8为yellow,IE7为blue,IE6为red
IE | Firefox | Chrome | Safari | Opera | iOS Safari | Android Browser | Android Chrome |
---|---|---|---|---|---|---|---|
6.0-8.0 | 2.0+ | 4.0+ | 3.1+ | 3.5+ | 3.2+ | 2.1+ | 18.0+ |
IE9.0+ |
<!DOCTYPE html> <html lang="zh-cmn-Hans"> <head> <meta charset="utf-8" /> <title>结构性伪类选择符 E:root_CSS参考手册_web前端开发参考手册系列</title> <meta name="author" content="Joy Du(飘零雾雨), dooyoe@gmail.com, www.doyoe.com" /> <style> html:root { color: #f00; } </style> </head> <body> <ul> <li>列表项一</li> <li>列表项二</li> <li>列表项三</li> </ul> </body> </html>
点击 "运行实例" 按钮查看在线实例