css - Polymer 2.0样式模块共享样式在网页上打印css源码

标签 css polymer-2.0

我正在使用带有 polymer 2.0 ( https://www.polymer-project.org/2.0/docs/devguide/style-shadow-dom#style-modules ) 的样式模块。

样式有效。然而,在 Chrome 中,CSS 内容打印到网页上看起来像乱码。在 Firefox 中完美运行。我该如何在 Chrome 中解决这个问题?提前致谢。

这是我的:

lbw-css-styles.html

<dom-module id="lbw-css-styles">
  <template>
    <style>
    :root {
    background-color:green;
...
    </style>
  </template>
</dom-module>

页面测试.html

<link rel="import" href="bower_components/polymer/polymer.html">
<link rel="import" href="bower_components/polymer/polymer-element.html">
<link rel="import" href="lbw-css-styles.html">

<dom-module id="page-test">
  <template>
     <style include="lbw-css-styles">
...
     </style>
  </template>

  <script>
    Polymer({
      is: 'page-test',
  </script>
</dom-module>

最佳答案

想通了。我的 css 引用了一个现在在 polymer 2.0 中弃用的“:root”选择器。删除已弃用的选择器可解决此问题。

关于css - Polymer 2.0样式模块共享样式在网页上打印css源码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44982013/

相关文章:

javascript - 如何使用webpack html插件在头部注入(inject)css包和在体内注入(inject)js包

facebook - 如何在 extJS 3.4 中设计薄滚动条,如 facebook 提供的列表和聊天

html - 使用 Laravel 在表内 Bootstrap 折叠

css - 我如何重构CSS?

jquery - div 向下推送内容