html - :root imported CSS not working in safari and IE 11

标签 html css safari internet-explorer-11 css-variables

: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.7IE11

最佳答案

这个 css3 选择器在所有 edge 浏览器中都可以正常工作,所以有一些小问题,请看我的图片,希望对您有所帮助。

enter image description here

关于html - :root imported CSS not working in safari and IE 11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46231941/

相关文章:

javascript - 用户离开页面时如何发送ajax请求

javascript - 在 Controller 中无法使用 ng-repeat 在弹出窗口中显示内容?

javascript - 使用 Vanilla JS 将事件和函数附加到动态元素

html - Bootstrap 3 vs Bootstrap 4 字体渲染

html - 多个响应图像

css - 在某些浏览器中,如何去掉文本框控件右下角的小人字形

javascript - 在 IE7 中显示 javascript 生成的 div

html - 调整/缩放内部容器中的字体

ios - 移动 Safari 中的 React PWA 图像上传会破坏应用程序吗?

javascript - console.log(document.head) 结果随每次刷新而交替