HTML link to part of page

You can also use links to navigate to a specific place within a page (not necessarily the current one). As a place on the page to which the link will be carried out, any HTML element that can be used within the <body> element is used. To define the element to which the transition will be performed, it must specify ID by using the id attribute:


<h2 id="a1">Heading</h2>

Now, if you click on a link to go to an element that is on the same page as the link leading to it, you need to write the grating character (#) as the value of the href attribute of the <a> element, after which you specify the identifier of the element to which the the transition is made:

<a href="#a1">link</a>

To go to a specific place on another page, you need to specify # and the required identifier after the URL:


<a href="httр://www.example.com#a1">link</a>


<a href="example/page.html#a1">link</a>

Note: the main benefit of the links inside the web page is that on pages with a large amount of content, the user does not have to scroll the entire web page in search of the desired section, and immediately clicking on the name of the desired section, go to it.

Copying materials from this site is possible only with the permission of the site administration and
when you specify a direct active link to the source.
2011-2018 © puzzleweb.ru

puzinfo@puzzleweb.ru | ruen