my dir looks like this
/static
/styles
- login.css
my python code is
@app.route("/login")
def login():
return render_template("login.html")
and my HTML is
<link rel="stylesheet" href="{{ url_for("static", filename = "\styles\login.css" ) }} " >
when my CSS was not rendering I checked page source code and it's like this
<link rel="stylesheet" href="/static/styles%5Clogin.css " >
what should I do to contact NASA?
The input of the css file should be: <link rel="stylesheet" href="{{ url_for('static', filename = 'styles/login.css' ) }} " >
The problem ist that with the double quotation marks before static
you closed the ones right after href
In one of my projects I have a structure like:
/static
/css
- base.css
- home.css
and I import base.css with the following code:
<link
rel="stylesheet"
type="text/css"
href="{{url_for('static', filename='css/base.css')}}"
/>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.