CSS变量在Microsoft Edge中不起作用 [英] CSS Variables don't work in Microsoft Edge

查看:601
本文介绍了CSS变量在Microsoft Edge中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设计一个新的Blogger模板.我想通过更改变量的值来轻松地同时更改整个模板的颜色,所以我使用了以下几行:

I am designing a new blogger Template. I want to make it easy to change the whole template color at the same time by changing the value of the variable , so I used these lines:

:root {
  --bg-color: #fff;
  --url-color : #000;
  --main-color : #2daeeb;
  --main-hover-color : #2ca1de;
  --alt-color : #ff6347;
}

但是不幸的是,即使我使用了前缀,它也无法在Edge浏览器中工作:

but unfortunately it doesn't work in Edge browser, even though I used the prefix:

-webkit-

推荐答案

IE也不支持CSS变量.

CSS variables are not supported by IE nor will they ever be.

更新:

自EdgeHTML 15(与Windows 10版本15063打包在一起,自2017年3月起提供)以来,Edge中均支持CSS变量.

CSS variables are supported in Edge since EdgeHTML 15 (packaged with Windows 10 version 15063, available since March 2017.

请参见此处在浏览器兼容性下.

See here under Browser Compatibility.

此外, W3C规范.

作为替代方案,您可以使用CSS预处理器按照描述的方式使用变量来编译CSS.

As an alternative you can use a CSS pre-processor to compile your CSS using variables in the way you describe.

Sass上的文档

精简文档

这篇关于CSS变量在Microsoft Edge中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆