我使用燒瓶development.This個人網站工作的CSS樣式表是我的樣式表的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中運行,這是從開發視圖在隱身模式下(以保持網站緩存): Sources-> Top-> localhost:5000-> static/css-> 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>
您不能在CSS中使用樣式註釋。這可能嗎? – cjs1978
這可能只是一個複製錯誤,但看看你的'.text-color'類。你有句號而不是逗號 – jtmingus
如果你沒有使用檢查CSS錯誤的IDE,請通過[W3的css驗證器](https://jigsaw.w3.org/css-validator/)運行你的代碼 –