There could be an error earlier in the CSS file that is causing your (correct) CSS to not work.
Answer from Andrew Koper on Stack OverflowThere could be an error earlier in the CSS file that is causing your (correct) CSS to not work.
Posting, since it might be useful for someone in the future:
For me, when I got here, the solution was browser cache. Had to hard refresh Chrome (cmd/ctrl + shift + R) to get the new styles applied, it seems the old ones got cached really "deep".
This question/answer might come in handy for someone. And hard refresh tips for different browsers for those who don't use Chrome.
CSS styles not applying to website. Why? Pls help beginner.
HTML class not available in CSS
Some CSS classes not working! : Forums : PythonAnywhere
DUPLICATE: CSS class styles are not working
Videos
I had a similar issue, I believe the problem was coming from the name of my CSS folder in which I had the CSS file. The folder was named "CSS", I'm not sure why it was causing issues but when I put my css file into my "js" folder it worked perfectly fine. Then I created a new folder named "myCSS" and it worked still. This is a weird workaround but it solved my issue and it may be useful to someone else.
also for the link I just had <link rel="stylesheet" href="myCSS/style.css" />
Can you check your network tab that your style.css is fetched from server and there is no 404 not found.
I would say try "/styles.css"
LPChip suggested me to use the debugger/inspector of Firefox and there, the head is greyed out. On further investigation, I noticed it said "css was not loaded because its mime type "text/html" is not "text/css"
That made me check something...
I got the solution:
I had an apache mod_rewrite activated. While the path was correct, it seems that this mod_rewrite or the dedicated php for the redirection somehow told the browser that the file was html not css.
I had a similar issue. Was setting up a NGINX from scratch and all the styles for my project were not applied. But they existed and I did not had any other error.
I found out that I had to apply the correct mime types to all files served by NGINX. Before the fix it was text/plain and this did not worked.
I fixed it by adding those lines to NGINX configuration:
http {
# other config before ...
include /etc/nginx/mime.types;
default_type application/octet-stream;
# rest of config ...
}