Nesting an a element

challenge question:
You can see the words cat photos underlined next to the image in the preview now. That’s your link; feel free to give it a click. In the text of your p element, turn the words cat photos into a link to . When you are done, remove the old anchor tag and text below the paragraph.

my code:

<p>Click here to view more cat photos.
      <a href="" target="_blank"> cat photos</a>

but the code did not pass, it says:
After nesting the anchor (a ) element, the only p element content visible in the browser should be Click here to view more cat photos. Double check the text, spacing, or punctuation of both the p and nested anchor element.

1 Like

You´re supposed to turn the words cat photos that are already inside <p> into a link but instead, you wrote cat photos again and turned this duplicate into a link.

i couldn’t do it because i don’t know how

take a look at this:

<p href="" target="_blank"> cat photos.

am sorry i know i was wrong, i don’t know what to put to link only cat photos.

here you have the words “cat photos”, without a link (it should be a link)

here you have the words “cat photos” again, this time you have them correctly in a link.

You need to remove those without a link, and then do small fixes to have the sentence correct

If you reset the challenge and look at the original code, you have a full p element and a full anchor element. The challenge is asking you to copy the entire anchor element on the second line and use it to replace the phrase ‘cat photos’ in the p element.

That’s called ‘nesting’ the anchor element inside of the p element. You current code is close but not quite doing that. You’re mixing up the parts of the two elements instead of nesting them.

i did this:

<p>Click here to view more<a href"" target"_blank"> cat photos</a>

but its saying that the link href i s omitted or typo even when i copied the link href and pasted it.


It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

please do not post your solution on the forum. It is not helpful to someone who is genuinely here to learn to code.