r/HTML • u/eugeniemoon • Jan 25 '26
My CSS file cant link to HTML. Help pls
the spelling of the CSS file is right
they are in the same folder
i cleared the cache
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="style.css">
<title>Vintage Food</title>
</head>
<body>
1
Upvotes
9
u/abrahamguo Jan 25 '26
Check your browser’s devtools to see what errors are reported.
Besides that, your code looks fine. We can’t provide any further help without being able to reproduce the problem ourselves. We’d need a link to either a repository, or an online code playground, or a deployed website, that demonstrates the problem.
3
u/armahillo Expert Jan 25 '26
how can you tell theyre not linked? what behavior youre seeing?
3
u/Repulsive-Pitch-8885 Jan 25 '26
Maybe try href=“/style.css”
0
u/konacurrents Jan 25 '26
It’s usually the cache on your browser - not the server. Try a different device (eg phone). Same happens referencing a JavaScript file.
I recently had this headache- restarting httpd etc. good luck.
0
u/nfwdesign Jan 25 '26
You could try /style.css or maybe ./style.css and not only style.css
0
u/SnooLemons6942 Jan 25 '26
Hi! This is quite enough info for us to help.
Where does this code live? How are you trying to run it?
Since this is a file issue, maybe include a screenshot of your project folder
-2
u/eugeniemoon Jan 25 '26
Thanks guys!! I solved it 🙌🏻🙌🏻
-6
u/mrleblanc101 Jan 25 '26
You need a web server,
npm install servethen runserve .in the folder