February 2017

Introduction to anchors

Hypertext links or hyperlinks (anchors) are HTML elements that, when clicked on, enable readers to visit a new address. Hyperlinked text is underlined by default. Hyperlinks are what connect web pages to one another. They are used to travel:

  • to another point in the same document
  • to an HTML file in a different location on the computer which hosts the page
  • to another computer
The primary attribute of anchors is href. It is written this way:
<a href="Address or URL"> .. </a>

External links

An external link is a link to a page indentified by its URL
For example:

<a href="http://en.kioskea.net/">How Does It Work? </a>

Internal links

A link can be made pointing to a page located on the same computer, by replacing the URL with the target file.

This link's location can be defined relatively, by describing the target file in relation to the source file. If the source file is "index.html" located in the parent directory, a link to it will be written:

<a href="../index.html"> ... </a>

This link may also be defined absolutely, by locally writing the address of the target file:

<a href="file:///drive:/folder/index.html"> ... </a>

Skip links

It is also possible to create a link to a spot within a page; in other words, to mark a precise spot on the page where the hyperlink will take the reader. Skip links are defined with the NAME or ID attribute. The following syntax should be used wherever you want the target to be:

<a name="internal_link"> ... </a>

This is how to link to that location:

<a href="#internal_link"> ... </a>

With these tags, you can enable the user to move up or down within the same page, or access a specific section on another page:

<a href="url/file_name.html#internal_link"> ... </a>


Liens hypertextes et ancres - HTML
Liens hypertextes et ancres - HTML
I link ipertestuali
I link ipertestuali
Assembler instruction
Assembler instruction
This document, titled "Hyperlinks," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).