Hypertext links and anchors - HTML

Hypertext links and anchors - HTML

Our video

Loading your video "FAQ: Hypertext links and anchors - HTML"

Anchors

The Hyperlinks (anchors) are elements of an HTML page (underlined when it is text) allowing Internet users to navigate to a new address when clicked. These are the hypertext links that make it possible to link web pages to each other. In particular, they allow you to navigate:



  • to another place in the document.
  • to an HTML file located in a different location on the machine hosting the page.
  • to another machine.

The main attribute for anchors is href. It is written in the following form:

..

external link

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

How it works?

Lien local

You can create a link to a page located on the same computer by replacing the URL with the target file. This link can be done relatively, by locating the target file in relation to the source file. If the target file is "index.html" located in the parent directory, its link will be written:

...

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


...

Anchors

It is also possible to create an anchor in a page, that is to say mark a specific place on a page to go there by a hypertext link. Anchors are defined using the NAME or ID attribute. The syntax is as follows:


...

Calling an anchor is done as follows:

...

It is thus possible to allow the user to move within the same page or to access a particular section of another page:


...

add a comment of Hypertext links and anchors - HTML
Comment sent successfully! We will review it in the next few hours.

End of content

No more pages to load