:root
选择器在某些浏览器中不起作用。
代码:
:root {
--blue: #4d6fd3;
--yellow: #d8c812;
}
h1{
color: var(--blue);
}
h2{
color: var(--yellow);
}
<h1>This is a heading with blue color</h1>
<h2>This is a heading with yellow color</h2>
这些导入的 CSS 不适用于 Safari 5.1.7 和 IE11。
最佳答案
关于html - :root imported CSS not working in safari and IE 11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46231941/