:root
概述
语法
:root
示例
在声明全局 CSS 变量时 :root
会很有用:
:root {
--main-color: hotpink;
--pane-padding: 5px 42px;
}
规范
Specification | Status | Comment |
---|---|---|
Selectors Level 4 :root |
Working Draft | No change |
Selectors Level 3 :root |
Recommendation | Initial definition |
浏览器兼容性
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 1 | (Yes) | 1.0 (1.7 or earlier) | 9 | 9.5 | 1.0 |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | ? | (Yes) | ? | ? | ? | ? |