So i have this weird problem that any css i write doesn't work. I tried to create multiple pages and link css but it simply doesn't apply. If i download a template of the internet if i run the page, their html works.
Here is an example of the most basic code i've written that doesn't work, even though i've run it through validators. It doesn't matter what element im trying to apply styling to it doesn't work.
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> Test Page </title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1> Sup! </h1>
</body>
</html>
CSS
body {
font-size: 16px;
color: #fff;
background-color: #61122f;
}
I have tried numerous solutions i've found online, but none of them work.
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With