HTML| Anchor Tag | How to link to a specific section of the page

| By Webner

In HTML, if one needs to create a link that redirects to a specific section of that page, following steps must be followed:

1.Give unique id to the section of HTML page where you want the link to be redirected to. In the example below, we
want to take a link click to a section that starts with H1 tag. So we are giving a unique id ‘jumpHere’ to this h1 tag:

<h1 id=”jumpHere”>Random text</h1>

2. Now use this syntax to create the hyperlink that will take the user to h1:

<a href=”#jumpHere”>link that will take user to h1</a>

Note: Before writing id value in <a href> tag, “#” is mandatory

Leave a Reply

Your email address will not be published. Required fields are marked *