【问题标题】:How to get CSS Variables working in Dart如何让 CSS 变量在 Dart 中工作
【发布时间】:2015-09-08 21:53:29
【问题描述】:

我在互联网上寻找过这个,但找不到一个有效的例子。有人可以指导我让 CSS 变量在 Dart 中工作吗? 资源: http://www.w3.org/TR/css-variables/ 有人提到了csslib,但我没有看到解决方案: https://github.com/dart-lang/sdk/issues/16710 https://github.com/dart-lang/csslib/issues/9

我正试图让这个在聚合物组件内部工作:

:host {
    --text-color: #4f1f91;
}
.someLabel {
  color: var(--text-color);
}

我知道我可以使用 dart/polymer 变量并执行以下操作:

.someLabel {
  color: {{ polymerVar }};
}

但是,为什么 CSS 变量在 08/2015 上不起作用??

【问题讨论】:

    标签: css dart polymer


    【解决方案1】:

    Firefox 是目前唯一原生支持 CSS 变量 http://caniuse.com/#feat=css-variables 的浏览器 Polymer 1.0 为其他浏览器提供了一个 polyfill。 Polymer.dart 0.17(Polymer.js 1.0 的 Dart 端口)目前处于 alpha 状态,但已经可以进行试验(参见最后一个 问题)。 我不知道 polyfills 是否可以在没有 Polymer 的情况下使用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-06-15
      • 1970-01-01
      • 1970-01-01
      • 2013-05-04
      • 2020-12-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多