:root
概述
语法
Error: could not find syntax for this item
示例
在声明全局 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 |
浏览器兼容性
BCD tables only load in the browser