'Can't add css style to html file
I have got a question about adding css style to html file. I am trying to create my own online page using library flask. I have tried to add css style from my computer into html document using following syntax:
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
but only result was, it displayed me an error, that the page /static/style.css doesn't exist. I have also tried this piece of code:
<style>
@import url("css/style.css");
</style>
but this time it haven't done anything. Please, can someone help me, how to solve this? Here I am also posting the picture of my poject folder.
Thank you for your help.
Solution 1:[1]
Ok, See First Your Html File Is In templates and you're importing css file in static so fist we need to move out of templates so,
Replace:
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
To:
<link rel="stylesheet" href="../static/style.css">
There you go.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | TheJoaqun |
