Anchors

Anchor can be used to navigate to different sections of a page that is too long to be displayed on a single computer screen or to navigate to specific section of another web page.
Defining the anchor
* Using the <a>..</a> element together with the name attribute.
<a name="name_value">Your Text</a>
*Using any HTML element together with the universal attribute id.
<a id="id_value">
#name_value #id_value
snippet
<html>
<head></head>
<body>
Click on the below link  to follow the link
<a href="#p1" id="p1">Link to Paragraph 1</a><br />
<a href="#p2" id="p2">Link to Paragraph 2</a><br />
<a href="#p3" id="p3">Link to Paragraph 3</a><br />
<a href="#p4" id="p4">Link to Paragraph 4</a><br />

<p id="p1">Text of the Paragraph 1</p><br />
<p id="p2">Text of the Paragraph 2</p><br />
<p id="p3">Text of the Paragraph 3</p><br />
<p id="p4">Text of the Paragraph 4</p><br />
</body>
</html>
Output
Click on the below link to follow the linkLink to Paragraph 1 Link to Paragraph 2 Link to Paragraph 3 Link to Paragraph 4

Text of the Paragraph 1

Text of the Paragraph 2

Text of the Paragraph 3

Text of the Paragraph 4

Anchors for the external file
snippet
<html>
<head></head>
<body>
Click on the below link  to follow the link
<a href="page.html#p3">This link to an anchor defined in an external file</a>
</body>
</html>
Output
Click on the below link to follow the linkThis link to an anchor defined in an external file
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +