Applied Accessibility: Give Links Meaning by Using Descriptive Link Text // "Make sure your a element has a closing tag." issues

<body>
  <header>
    <h1>Deep Thoughts with Master Camper Cat</h1>
  </header>
  <article>
    <h2>Defeating your Foe: the Red Dot is Ours!</h2>
    <p>Felines the world over have been waging war on the most persistent of foes. This red nemesis combines both cunning stealth and lightening speed. But chin up, fellow fighters, our time for victory may soon be near. Click here for <a href="information about batteries">information about batteries</a>.</p>
  </article>
</body>

Are you using chrome?
Also the href attribute should have a link or make it a dead link with “#” if you do not have link.
Which challenge is this?

Where in the challenge instructions did it tell you to add “information about batteries” as the href attribute’s value?

In the future, either tell us the challenge url or click on the Ask a Question button located on the challenge. The latter will add your code and the challenge url to the topic automatically.

https://www.freecodecamp.org/learn/responsive-web-design/applied-accessibility/give-links-meaning-by-using-descriptive-link-text

Hi there, yes! chrome

" Applied Accessibility: Give Links Meaning by Using Descriptive Link Text"
It says to " Move the anchor ( a ) tags so they wrap around the text “information about batteries” instead of “Click here”.", which I did.
But the is somehow not seen by the compiler

I was able to solve the challenge. You are just moving the a tags to wrap around “information about batteries” instead of “Click here”.

You should not have anything besides “” in the href attribute. You are not supposed to change that. That is why you are getting the error.

1 Like

oh hell that did it; why does that make sense though?

edit: thank you by the way, this helped!

if I had the same text within the href attribute, my output looks the same from the user end; so why is it wrong to have text within an href attribute (in this case)?

the href attribute is where the anchor point, it doesn’t have sense to have a sentence there instead of an url, and information about batteries is not a valid url

1 Like

https://www.w3schools.com/tags/att_a_href.asp

The href attribute is supposed to have a link destination, that is why.
href=“information about batteries” That is not a link to any destination

From the link above:

Possible values of href:

  • An absolute URL - points to another web site (like href=“http://www.example.com/default.htm”)
  • A relative URL - points to a file within a web site (like href=“default.htm”)
  • Link to an element with a specified id within the page (like href="#top")
  • Other protocols (like https://, ftp://, mailto:, file:, etc…)
  • A script (like href=“javascript:alert(‘Hello’);”)
1 Like

In this specific case, the tests where not expecting anything but a blank string string for the href attribute’s value. I have created a pull request which will add another test to specifically check for the blank string (and give applicable message), so the test for the closing anchor tag is not part of the test for the href attribute. This should make the challenge tests a bit clearer for future users.

Ah okay that’s starting to make sense. So, in what case would the test expecting a non-blank string (a string with something in it)?

Thanks for the pull request, it’ll definitely clarify it for future users :slight_smile:

ohhhh that makes sense now.
so href attributes will only have links (www.stuff.com), protocols, scripts, but never just plain text “hello”

ah okay got it. thank you so much! :slight_smile:

There are no tests like that for this particular challenge. Other challenges will possibly expect a value (i.e. url or hash character).

1 Like

Thank you. It worked!