-1

The problem I have is that I have a html site which cant find the css I am linking. The html site is opened via flask in my local host which works but I get an error that says that the css file cant be found. If is click on my html file and open it normally, the css works, but via flask not.

I also tried multiple folder structures:

1) main.py

templates(folder)

-index.html

static(folder)

-main.css

  1. current structure: main.py

templates(folder)

-index.html

-main.css

The way I link to my main css with folder structure 2:

<link href="main.css" rel="stylesheet" type="text/css">

I have also tried al variations from this answere but none of them work.

HTML not loading CSS

Main.py

[html filecss file

1 Answers1

0

Have a look at https://www.hostinger.com/tutorials/website/how-to-link-a-stylesheet-css-file-to-your-html-file

You could also try the tag

If it is in a folder and they are Both in the same folder you should try:

and you should put this in the header


Here is an example:

 **HTML:**

<!Doctype HTML>
 <html>
  <head>
    <link rel="stylesheet" type="text/css" href="main.css" media="screen"/>
  </head>
  <body>
    <div id="test">
      <p> This is an example paragraph </p>
    </div>
  </body>
 </html>

 **CSS**

#test {
  color: #ffffff;
}

Try ./main.css or /main.css or .main.css