Published January 10, 2020
The Answer is A.
An anchor link is a link on a web page which allows a user to jump to a designated section of that page.
Click here to see how it works!
The purpose of anchor links is to prevent users from having to scroll endlessly in order to find a particular section of a page. By clicking on the anchor link, they will instead be guided directly to the area of their choosing.
For example, if you have a page that is broken down into multiple sections, you can set up a menu with an anchor link to each individual portion, allowing a user to immediately navigate to a particular component.
This is done by setting up an “ID” for each section you wish to link to within the HTML. You then "call out" to that ID when you link the menu item.
Here's how it would look:
Let's say you want to link to the "About Us" section of the page. Set an ID at the top of this portion; this is often done on the title of the section, as it is typically the component which comes first.
<h1 id="about">About Us</h1>
Once this ID has been designated, swing back up to the part of the navigation menu which you'd like to link to this section. Add an <a> tag to set up a link for the About Us navigation item; instead of adding a full URL, add the ID you previously set up, with a hashtag in front of it, like so:
<a href="#about">About Us</a>
Now, when that link is clicked, your browser will automatically scroll to the section of the page where that ID—in this case #about—resides.
Anchor links are especially useful on long web pages which may require a user to scroll quite a bit. To avoid the possibility of a user losing interest before the desired section can be reached, it may be advisable to set up an anchor link—or multiple links—where appropriate.
Subscribe to the 'Inbound & Down' Question of the Day
Sign up to receive a new inbound multiple choice question delivered to your inbox every morning.
Explore more inbound learning on the 'Inbound & Down' Podcast.