Python Flask Basics Templates and Static Files Static Files

Diem Pham
Diem Pham
12,276 Points

why styles.css doesn't work on Chrome?

The background and font color do not change on Chrome but they do on Safari. Could anyone please explain why?

4 Answers

jason chan
jason chan
31,004 Points

clear browser history or refresh a few times. Or try icognito.

You might have to do css prefixes. I hope that helps.

Yosef Fastow
Yosef Fastow
18,526 Points

I had the same problem but if you refresh it a few times it fixes itself. It is weird that that is happening. I'm using firefox.

Wu Ray
Wu Ray
2,359 Points

actually I also have the same problem, it seems the browser's cache stop to read the new scripts. try eliminate the history data would help instantly. :)

Daniel Kaczmarczyk
PLUS
Daniel Kaczmarczyk
Pro Student 5,536 Points

I had the same issue, what helped me is adding the type="text/css" tag.

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

Ming Jun Lim
Ming Jun Lim
10,060 Points

Thank you, this worked!

Make sure the it is type="text/css" and not type="css/text"

In Chrome if you go to the DevTools settings, you can disable the cache as long as DevTools is open.