CSS样式表未加载所有选择器

时间:2017-05-11 21:24:04

标签: html css

我正在使用flask进行开发的个人网站。这是我的样式表style.css

<style>
.red-text{
  color: rgb(255,0,0);
  padding: 20;
}
/*color of unselected tabs and left navigation menu*/
.navigator-color{
  background-color: rgb(33,37,43);
}
.display_color{
  background-color: rgb(40,44,52);
}
.selected-tab{
  background-color: rgb(42,46,54);
}
.text-color{
  color:rgb(183.186,193);
}
.highlight_color{
  background-color: rgb(86,138,242);
}
/* - - edit, I had incorrect comment, but I added in my question and it wasn't in my actual style sheet-- this should change h2 to blue, but it doesnt */
h2{color:rgb(0,0,255)}
</style>

这是来自开发人员视图,当网站以隐身模式在Chrome上运行时(为了防止网站缓存): 来源 - &GT;顶&GT;本地主机:5000-&GT;静态/ CSS-&GT; style.css中 我的h2风格完全脱光了。

.red-text{
  color: rgb(255,0,0);
  padding: 20;
}

/*color of unselected tabs and left navigation menu*/
.navigator-color{
  background-color: rgb(33,37,43);
}
.display_color{
  background-color: rgb(40,44,52);
}
.selected-tab{
  background-color: rgb(42,46,54);
}
.text-color{
  color:rgb(183.186,193);
}
.highlight_color{
  background-color: rgb(86,138,242);
}

由于某种原因,它会按类定义加载样式,但它不会按照元素或id加载样式(不包括在内,但是同样的结果,我把所有东西都拉出来试图让它工作。)

我真的不明白这个问题是什么,过去3个小时我撞到了一堵砖墙。

<!doctype html>
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ title }}</title>
    <link rel="icon" href="{{ url_for('static', filename='img/favico.png') }}" type="image/x-icon" />
    <link rel=stylesheet type=text/css href="{{ url_for('static', filename='css/style.css') }}">
  </head>
  <body>
    <header>
      <h1 class="red-text">THIS WILL CHANGE THE COLOR</h1>
      <h2>THE COLOR REMAINS UNCHANGED</h2>
    </header>

    <footer>
    </footer>
  </body>
</html>

1 个答案:

答案 0 :(得分:-1)

docker exec -i mycontainer bash -c ''

修改:所做的更改:使用/ * ... * /样式注释替换样式注释,并从样式表中删除.red-text{ color: rgb(255,0,0); padding: 20; } /*color of unselected tabs and left navigation menu*/ .navigator-color{ background-color: rgb(33,37,43); } .display_color{ background-color: rgb(40,44,52); } .selected-tab{ background-color: rgb(42,46,54); } .text-color{ color:rgb(183.186,193); } .highlight_color{ background-color: rgb(86,138,242); } /* this should change h2 to blue, and now it probably does */ h2{color:rgb(0,0,255)} 标记。