CSS 自定义属性(变量)允许你存储一次值并重复使用。与预处理器 (Sass) 变量不同,它们在运行时是活动的——它们级联、继承,并且可以通过 JavaScript 或媒体查询进行更改。
css
:root { /* :root = the html element → global scope */
--color-primary: #3b82f6;
: ;
: ;
}
{
: (--color-primary);
: (--spacing);
: (--radius);
}
