html

How to link to a specific part of a page with HTML

In HTML, a “hyperlink” is a type of link that comprises a destination address that also behaves as a reference to some information. It enables the user to quickly jump or follow the added web address either by tapping, clicking on the linking, or hovering over it. Whereas, “Jump links” not only load the web page but also jumps to the specified part of a page.

This blog will discuss the procedure to link to a specific part of a page with HTML. So, let’s start!

Jump links in HTML

Jump links are mostly utilized to redirect the users to a specific part in longer web pages. These types of HTML links offer an easy and quick way for creating shortcuts to the targeted part within an HTML page. Also, adding Jump links only required basic HTML knowledge and it works no matter where the user is coming from.

Now, look at some fantastic benefits of adding Jump links in HTML.

Benefits of using Jump links with HTML

Here is a list of some of the benefits of using Jump links with HTML:

  • Adding Jump links can improve the navigation across the website of an organization. It permits users to jump to a specific part rather than manually scrolling through the web page.
  • Scrolling and clicking to find the required information can take a lot of your precious time. However, jump links can improve the usability of a web page and enhance its efficiency.
  • With the help of the Jump links, you can organize website elements and finding the desired content will get easier for the users.

How to add a link in HTML

“<a>” tag is used to embed links in HTML. The specific link is placed between the opening “<a>” and closing “</a>” tags. <a> tags with the href attributes are used to embed a link to any targeted section of the page. Hash symbol “#” and the section “id” are also mentioned in href for creating a jump link.

Here is a sample code for adding a link in HTML:

<a href="https://www.google.com/">Google Search</a>

The line under the “Google Search” text indicates that a link is attached to it:

Clicking on the above-given highlighted text will redirect toward Google official website:

Now, we will move ahead and discuss the method of creating a Jump link in HTML.

How to create a Jump link with HTML

For the purpose of creating a Jump link with HTML, follow the given instructions.

  • First of all, name the specific part or the destination object where you want to jump.
  • Then, create an HTML anchor tag<a>” or a Jump link and specify the element name in the “id” attribute and add it into the “a>” opening tag.
  • Lastly, click on the added hyperlink as it will navigate you towards the section where you want to move.

Example
Suppose, we have a long web page containing information related to the research approach for writing an article. It comprises different paragraphs with the headings “L1: Research”, “L2: Understanding”, “L3: Command Execution and Screenshots”, “L4: Write-up”, and “L5: Proof-reading and Removing Plagiarism”.

Step 1: Assign “id” to the specific part
In the first step, assign an “id” to the specific part of the web page where you want to jump. In our case, we will add a Jump to move to the top of our web page where the main heading is placed. To do so, we will assign “Research_Approach” as an “id” to our “Research Approach for writing an Article” heading:

<h2 id="Research_Approach">Research Approach for writing an Article</h2>

Note: While assigning “id”, do not separate the words with spaces and try not to use colons:”, periods “.”, and the hashtag “#” at the beginning as these characters have pre-defined functionality in HTML. Instead, utilize dashes or underscores to combine words.

Step 2: Create anchor tag “<a>”
Then, we will create an anchor tag “<a>” and link it to the “h2” by specifying its “id” attribute in “href” with the “#” character:

<a href="#Research_Approach">top</a>

At this point, our web page looks like this:

Also, the added hyperlink or the Jump link is placed at the end of the web page:

Step 3: Click on the added hyperlink
Lastly, we will click on the added hyperlink to the “top” text for jumping to the main heading of our web page:

As you can see, with the help of added jump or anchor link, we have successfully moved to the specified part of our web page:

We have compiled the easiest method for linking to a specific part of a web page.

Conclusion

For linking to a specific part of a page with HTML, firstly name the specific part or the destination object where you want to jump. Then, create an HTML anchor tag “<a>” or a Jump link by assigning the object name to the “id” attribute by adding “#” in the start and embed it into the opening <a> tag and click on the added hyperlink as it will navigate you towards the specific part of the page where you want to jump. This blog demonstrated the procedure to link a specific part of a page with HTML.

About the author

Sharqa Hameed

I am a Linux enthusiast, I love to read Every Linux blog on the internet. I hold masters degree in computer science and am passionate about learning and teaching.