In-Page Links

The last function of hypertext links is linking to sections on our page. First, let's remind ourselves of the id attribute, as we will need it. The id attribute is used to identify HTML elements and apply styles to them.

<div id="breeds"></div>

If we want this section (div element) to be visible, our hypertext link would look like this:

<a href="#breeds">Link to the breeds section</a>

Now let's analyze the value of the href attribute. The # at the beginning tells us that we are linking to an element with the id attribute, and breeds specifies the value of the id attribute of the element we want to link to.

There is one special case:

<a href="#">Link to the top of the page</a>

When we set the href attribute value to just #, it means that we want to scroll the page to the very top.

Instructions

Add id attribute with the value breeds to the last div element.

Change the link that has an image of six cats as its child to link to the breeds section and remove its target attribute and its value.

Don't forget to remove the target attribute.

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with:

9/10

In-Page Links | Start Coder