Newbie unable to link css file to html

Hey everyone,

I am starting my first project and already cannot link my css file to html file successfully in VSCode. I removed the period in front of the file which allowed the text editor to find it, but it still won’t link. Here is what I have for both (these are just copy/pasted from my lesson in codecademy btw, I didnt write these):

<!DOCTYPE html>
<html>
    <head>
        <link href="/resources/css/index.css" type="text/css" rel="stylesheet">
        <title>James Gray Beginner Coding</title>
    </head>

and my stylesheet is as follows:

* {
    font-family: Helvetica, Arial, sans-serif;
  }
   
   
  h1 {
    color: SeaGreen;
  }
   
   
  p, 
  li {
    font-size: 18px;
  }
   
   
  a {
    text-decoration: none;
  }

None of these features appear to be present on the webpage. Again my file directory is exactly as Codecademy has instructed. Please help!

Ok so I got it work but only by going totally against what Codecademy is teaching me to do.

Moved my index.css file into the same folder as my index.html and cut the href link to just “index.css” and it worked. That is the only way I could get this to work and Im proud and everything but, how do I link files from other folders successfully? Ill keep trying but this is concerning.

since you were using /resources/css/index.css, I’m assuming your index.css file was inside a folder named css, and that folder was inside another folder called resources ?

The solution was removing the “./” from the beginning of the image reference. It worked totally fine after that in the directory style they taught me. Thanks for responding

1 Like