首页 > 解决方案 > CSS网格未在chrome上显示 - 200错误

问题描述

我无法在不同的浏览器中正确显示我的 CSS 网格。

我在终端“GET /static/stylesheets/style.css HTTP/1.1”200 中收到此错误 -

左边是火狐,右边是Chrome

在左侧的 Firefox 中,一切正常!

右侧的 Chrome 未显示任何 CSS。

知道发生了什么吗?

索引.html:

<!DOCTYPE html>
<head>
    <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='stylesheets/style.css') }}" />
    <title>This is the title</title>
</head>
<body>
    <h1>Lorem ipsum</h1>

<div class="wrapper">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
    <div class="item item5">5</div>
    <div class="item">6</div>
    <div class="item">7</div>
    <div class="item">8</div>
</div>    
</body>
</html>

CSS 文件:

*{
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body{
    background: white;
}
.wrapper{
    width: 90%;
    margin: 0 auto;

}
.item{
    background: blue;
    color: white;
    padding: 10px;
}
.item:nth-child(even){
    background: orange;
}

路线.py

from flask import Flask, render_template, url_for
from app import app

@app.route('/')
@app.route('/index')
def index():
    return render_template('index.html')

初始化.py

from flask import Flask 
app = Flask(__name__)  
from app import routes

标签: htmlcssflask

解决方案


推荐阅读