CSS Variables don't work in Microsoft Edge [duplicate]

六眼飞鱼酱① 提交于 2019-11-27 08:29:01

问题


This question already has an answer here:

  • Do CSS variables work differently in Microsoft Edge? 1 answer

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;
}

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

-webkit-

回答1:


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

Update:

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

See here under Browser Compatibility.

Also, the W3C spec.


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

Docs on Sass

Docs on Less



来源:https://stackoverflow.com/questions/39596531/css-variables-dont-work-in-microsoft-edge

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!