html - Polymer.js 浏览器兼容性 - 在 Firefox 和 Safari 中看不到 CSS

标签 html css cross-browser compatibility polymer-1.0

大家好,我是 Polymer.js 的新手,我正在构建我的 HTML 自定义标签,以便在我的前端工作中重用它们。问题是,当我尝试在 Safari 和 Firefox 中打开我的 index.html 时,我看到的只是没有所有 CSS 的 HTML。在 Chrome 中一切正常。我不明白为什么会这样。 我使用 Polymer 1.0.0,Firefox 和 Safari 都是最新版本。 有什么建议么? 谢谢大家。

这是代码(如您所见,我已经包含了 webcomponents-lite.min.js):

index.html

 <!DOCTYPE html>
    <html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="mobile-web-app-capable" content="yes">
    <title>Polymer Project</title>
    <script src="../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
    <link rel="import" href="app/components/pd-dashboard/dashboard-articles.html" />

<div class="row">

    <dashboard-articles> </dashboard-articles>

        </div>
     <div class="col-sm-2"></div>
</div>

</html>

dashboard-articles.html:

<link rel="import" href="../../../bower_components/polymer/polymer.html">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="import" href="../../components/articles/article-2col/article-2col.html">
<link rel="import" href="../../components/articles/article-1col/article-1col.html">
<link rel="stylesheet" type="css/text" href="../../components/pd-dashboard/dashboard-articles.css" />
<!-- Fonts --> 
<link href='https://fonts.googleapis.com/css?family=Dosis:800,600,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Nunito:400,700' rel='stylesheet' type='text/css'>
<script src="../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>


<dom-module id="dashboard-articles">
<template>
<div class="container-fluid">
    <div class="row" style="margin: 5px">    

</div>

  <div class="row"> 
      <hr>         
    <div class="row">
          <div class="col-sm-5">
              <article-1col></article-1col>
              </div>
           <div class="col-sm-7">


           </div>   

       </div> 

   </div>    


</template>
 </dom-module>


     <script>
            Polymer({
                is: "dashboard-articles"
            });

        </script>

最佳答案

问题解决了! <link> .css 文件必须在标签 <template> 内在您创建的每个组件中!

关于html - Polymer.js 浏览器兼容性 - 在 Firefox 和 Safari 中看不到 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35069747/

相关文章:

html - Bootstrap 轮播标题没有响应? (HTML, CSS)

javascript - 如何使标题居中?

html - 在 gatsby-remark-images 中水平居中溢出其容器的图像

html - 在输入组内 Bootstrap 多个输入

html - 使用 bootstrap 创建固定长度的导航栏

css - 信不信由你,Internet Explorer 的一个 css 问题

javascript - 覆盖整个屏幕的弹出窗口

html - 为什么不溢出 :hidden working in IE6?

javascript - 为什么我不能将 "window.location.reload"作为参数传递给 setTimeout?

javascript - 如何使固定元素在某个点不再随窗口滚动?