-1

I am currently learning HTML and I was trying to create an external CSS file. But when I try to link them together I keep getting a 404 error saying that the css file cannot be found. Both the HTML and CSS file is in the same folder. I am using Notepad++.

<html>
<head>
<link rel="stylesheet" type="text/css" href="global.css">
</head>
<body>
<form>
<ul>
    <li><h1>Member Login</h1></li>
    <li><label for="fname">First Name</label>
<input type="text" id="fname" name="firstname" placeholder="Your name.."></li>
    <li>Password</li>
    <li>Submit</li>
    <li>Forgot Password</li>
</ul>
</form>


</body>
</html>
evogamer
  • 39
  • 5

3 Answers3

0

This is your code from the third line

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

you forgot to add a back slash

'<link rel="stylesheet" type="text/css" href="global.css" />

Reference: https://www.freecodecamp.org/news/how-to-link-css-to-html/

  • I added a backslash and it's still showing me a 404 error of css not being found. – evogamer Dec 08 '22 at 14:54
  • Try giving the absolute path(you know C:\Users\XXX\XXX\myfirstwebsite\styles.css) of the css file. Also once again check if the css file is in a different folder than your html file. If it, great, if not you either move it to the same folder or give the absolute path. – ThefutureProf Dec 09 '22 at 17:33
-1

Type the path of the CSS file wherever you have saved it correctly in the html file.

 Hope it helps
-1

You forgot the closing tag in the link tag it should go

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