Question #6532   Submitted by Answiki on 09/02/2022 at 08:08:06 PM UTC

How to create a link to an anchor in HTML?

Answer   Submitted by Answiki on 09/02/2022 at 08:11:15 PM UTC

To make a link to a given place in an HTML page, it is necessary to create an anchor. To do this, you must insert an identifier (with the id attribute) at the desired location. Here are some examples:

<h2 id="subtitle">...</h2>
<div id="top-of-div">...</div>
<td id="row-of-table">...</td>

All you have to do is link to this anchor by placing the hash tag (#) followed by the anchor's ID:

<a href="#subtitle">...<a>
<a href="#top-of-div">...</a>
<a href="#row-of-table">...</a>

If the anchor is on another page, simply add the hash tag (#) followed by the identifier at the end of the URL:

<a href="http://example.com#subtitle">...<a>
<a href="http://example.com#top-of-div">...</a>
<a href="http://example.com#row-of-table">...</a>




2 events in history
Answer by Answiki on 09/02/2022 at 08:11:15 PM

To make a link to a given place in an HTML page, it is necessary to create an anchor. To do this, you must insert an identifier (with the id attribute) at the desired location. Here are some examples:

<h2 id="subtitle">...</h2>
<div id="top-of-div">...</div>
<td id="row-of-table">...</td>

All you have to do is link to this anchor by placing the hash tag (#) followed by the anchor's ID:

<a href="#subtitle">...<a>
<a href="#top-of-div">...</a>
<a href="#row-of-table">...</a>

If the anchor is on another page, simply add the hash tag (#) followed by the identifier at the end of the URL:

<a href="http://example.com#subtitle">...<a>
<a href="http://example.com#top-of-div">...</a>
<a href="http://example.com#row-of-table">...</a>




Question by Answiki 09/02/2022 at 08:08:06 PM
How to create a link to an anchor in HTML?
# ID Query URL Count

Icons proudly provided by Friconix.