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 https://freecatphotoapp.com . 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="https://freecatphotoapp.com" target="_blank"> cat photos</a>
      </p>

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.

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

Sure you do. You can look at how the existing link below the p element looks and use it to create the same link inside the p element. Give it a try and post your new code if you get stuck again.

take a look at this:

<p href="https://freecatphotoapp.com" target="_blank"> cat photos.
      </p>

p elements do not have href attributes or target attributes. The existing link looks nothing like what you have posted above.

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.

You just need to replace the current text cat photos in the p element’s sentence with the same exact anchor element below the p element and then delete the anchor element below the p element. That is what the instructions want you to do.

i did this:

<p>Click here to view more<a href"https://freecatphotoapp.com" target"_blank"> cat photos</a>
      </p>

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

You are VERY close now. Remember that attributes require an = between the attribute name and the value assigned to them. Also, make sure you have the same spaces in the sentence as they were before and don’t forget about the punctuation that was present in the original sentence of the p element.

Mod Edit: SOLUTION REMOVED

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.