Nesting a self-closing link element

Tell us what’s happening:
Describe your issue in detail here.
I’m having trouble with this step. It’s asking me to nest a self-closing link element with certain attributes under the head element, which I am doing but the system is saying the code is wrong. I have tried to place the element in different spots within the nest of the head element to no avail.

  **Your code so far**
\ file: <!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>
<!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: h1, h2, p {
text-align: center;
}
h1, h2, p {
text-align: center;
}
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36

Challenge: Step 17

Link to the challenge:

First, check for a spelling mistakes. You have a typo somewhere that is causing the problem, check what the lesson is asking you to type compared to your own code.

Aside from the typo that @Griff pointed out, this lesson requires you to close the link element even though it states it is self-closing (which it absolutely is). You can close it by using a forward slash (/) before the last angle bracket (>).

1 Like

I’ve done this and am following the code to the letter. I also researched the topic and found that my code is right. Maybe just a system error, not sure.

tried this and it gives the same error stating “Your code should have a Link element.”

Can you please post your current code?

Just figured out it was a typo under href=“styles.css” i was typing href=“style.css”

That will do it. EllaGriff mentioned the typo. I assumed you fixed it. Glad you figured it out!

1 Like

I had the same exact issue: nested a link element inside of the head element (exactly how the directions specify) and it comes back with an error. I checked spelling several times and it was correct.

The solution @Alabastor suggested was what resolved my issue.

But it’s confusing because does that mean “self-closing” for a link element looks different than for an img element?

image

I am getting an error message for the self closing link exercise. I have read previous responses like checking for typo errors and putting a backslash before the closing tag, all to no avail. I am at a loss as to what to do now. Image has been attached for my code and the error message I am getting.

You should have a forward slash before the closing bracket of your link tag: />

Put a / before the >.
Is should be like this;
Moderator edit answer

I am having a problem where it states problem about my rel attribute. IDK where I’m wrong

@learningnoob please open new topic next time, the way you are assigning values, isn’t the right way.

<example attribute="value">
1 Like