Ask coding questions

← Back to all posts
CSS linking not working
StingChameleon (1)

The following line is not working with regards to linking to my main.css file:

<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">

Everything works perfectly fine when I download my repository and run it on my local machine, but it does not work when running it from repl.it.

I've also tried:

<link rel="stylesheet" href="/static/css/main.css') />

I've tried moving main.css to the root and using:

<link rel="stylesheet" href="/main.css') >

Nothing is working. Any suggestions?

Answered by RYANTADIPARTHI (6006) [earned 5 cycles]
View Answer
Comments
hotnewtop
StingChameleon (1)

@RYANTADIPARTHI Yup, all good! I'll see if I can figure out how to mark this as answered.

StingChameleon (1)

Nevermind, figured it out. Had a space at the beginning of my main.css file. Wow.

SixBeeps (5047)

@StingChameleon Haha, happens to the best of us :)