我的问题是,我有一个 meteor 应用程序,更改样式的最清晰、最简单的方法是使用 CSS 变量。 但是:IE 根本不支持它们,所以我必须编写一个辅助函数,它会改变每个模板创建和用户交互的样式。 这个辅助函数很慢,而且很难看,所以我想仅为 IE 指定辅助函数,并在其他浏览器中使用 CSS 变量。 -如果浏览器是IE,如何在构建之前指定使用IEspec.css, 其他情况使用nonIEspec.css?
最佳答案
我不知道meteor构建过程,但你可以将其添加到你的index.html中:
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="ie-only.css" />
<![endif]-->
关于变量 IE 不支持它们,仅 Edge 15+ 支持。
In Edge 15, nested calculations with css variables are not computed and are ignored see bug In Edge 15 animations with css variables may cause the webpage to crash see bug In Edge 15 is not possible to use css variables in pseudo elements see bug
你有纯CSS变量还是类似SASS/LESS的变量?也许有一个编译器可以使它们成为 css 1、2 或 3。
检查兼容性 here
关于javascript - Meteor JS 具有 CSS 变量和 IE 支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45878360/