Link element wont work?

Hey! I am doing an exercise at the freecodecamp website, and it tells me that I must “add a link element to the head element”

I keep doing it but it just says I don’t have a link element nested in the head element. What am I doing wrong?

/* file: index.html */
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <link rel="stylesheet" type="text/css" href="style.css"> 
  <title>Cafe Menu</title>
</head>
<body>
  <header>
    <h1>CAMPER CAFE</h1>
    <p>Est. 2020</p>
  </header>
  <main>
    <section>
      <h2>Coffee</h2>
    </section>
  </main>
</body>
<html>
/* file: styles.css */
h1, h2, p {
text-align: center;
}
  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15

Challenge: Step 17

Link to the challenge:

Hi Cadma, the syntax of the link element looks good but it has no effect, which means it’s not able to find locate the styles.css file that the page gets it’s styling from. Any idea why that is?

Hi Jacques,
I see it looks like that in the code I copied, but in the actual page it seems like it works, do you mean it should have a line underneath to indicate that it can locate it?

Hey Cadma! I found your error. It was a typing error. Look at the name of the file css linked in your link tag!

Cheers! :smile:

1 Like

What’s appening is that your CSS is in styles.css and your link is pointing to style.css, which doesn’t exist. Check the href attribute in your link element.

1 Like

Thanks so much! It worked, I was just blind :smiley:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.