Could you please guys to solve this exam?

Nest an Anchor Element within a Paragraph

You can nest links within other text elements.

<p>
  Here's a <a target="_blank" href="https://www.freecodecamp.org"> link to www.freecodecamp.org</a> for you to follow.
</p>

Let’s break down the example. Normal text is wrapped in the p element:

<p> Here's a ... for you to follow. </p>

Next is the anchor element <a> (which requires a closing tag </a> ):

<a> ... </a>

target is an anchor tag attribute that specifies where to open the link. The value _blank specifies to open the link in a new tab. The href is an anchor tag attribute that contains the URL address of the link:

<a href="https://www.freecodecamp.org" target="_blank"> ... </a>

The text, link to www.freecodecamp.org , within the a element is called anchor text, and will display the link to click:

<a href=" ... " target="...">link to freecodecamp.org</a>

The final output of the example will look like this:

Here’s a link to www.freecodecamp.org for you to follow.

Nest the existing a element within a new p element. Do not create a new anchor tag. The new paragraph should have text that says View more cat photos , where cat photos is a link, and the rest is plain text.

It looks like you’ve just copied the description.

Do you have a question? If you can’t solve this, can we see the code that you’ve tried?

yes,
I tried to solve it like in the last paragraph but I can’t


<h2>CatPhotoApp</h2>

<main>

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

  <img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back.">

  <p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>

  <p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>

</main>

this is your a element, you need to create the p element around it

yeah…
that’s right,
must completed that based on instruction in the last paragraph in my first post,
i couldn’t solve it cause there’s not tutorial video available.

what have you tried? what are the tests saying?

<p target="View more cat photos"<a href="https://www.freecodecamp.org"> link to www.freecodecamp.org</a>for you to follow.</p>

still probs :upside_down_face:

any idea?

below is the problem:

Your a element should be nested within your new p element.

Your p element should have the text View more (with a space after it).

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

  1. You added a new a element. You should only use the a element that was already there.

  2. Your entire anchor element + paragraph should only have the text ‘View more cat photos’. You added a bunch of words that aren’t those words.

<a href="https://www.freecatphotoapp.com" target="cat photos"<p> link to www.freecodecamp.org ="View more cat photos"</p> for you to follow.</a>

Still problem :upside_down_face:

That’s because you didn’t do what I said :upside_down_face:

Let’s start from the beginning.

Instructions: The new paragraph should have text that says View more cat photos , where cat photos is a link, and the rest is plain text.

We know that the tag for a paragraph is <p></p>. So let’s start by throwing everything into a paragraph.

<p>View more cat photos</p>

However via the instructions, only cat photos needs to be a link. Not the entire paragraph. Luckily! The anchor tag can be using within the paragraph tag.

From this point wrap only the specified words within an anchor tag. Be very precise and follow the instructions to a T. Also look at the errors it throws at you. These can be very helpful on determining where things went wrong.

If you’re still having trouble. That’s absolutely fine and normal and at that point I would recommend moving back a few lessons and really solidify your knowledge on previous concepts. Knowledge will build on itself as you move through the lessons and it’s important to have a solid understanding as you move through your journey.

2 Likes

In order to nest this exercise you have to read carefully the directives for it.
The proper method is
<p> "something" <a href=the_link> Text_for_the_link </a> "something else </p>
The target attribute is used to specifie where to open the linked document (new tab or specific frame within the body of your page) and you don’t need it here

1 Like
<p> View more  <a href="#"> cat photos</a></p>
1 Like

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