Anchor (HTML)

from Wikipedia, the free encyclopedia

An anchor refers to a jump label within a HTML - document . In hypertext theory, the term anchor generally stands for the start and end point of a hyperlink .

Virtually every element can be to a label by one ID- Attribute receives. In old HTML versions, these jump labels had to be implemented using an additional aelement that was given an nameattribute. Hence the name: anchor (English for "anchor").

Since a jump label can appear within a URL , a subsection of a document ( fragment ) can be addressed directly via a hyperlink.

For example, a jump label can be defined for a subsection:

<h2 id="Ankername">Überschrift</h2>

Obsolete variant:

<h2><a name="Ankername">Überschrift</a></h2>

A hyperlink can now be used to refer to this jump label. When activating such links, the common browsers , HTML editors and other word processing programs that are based on the URL code jump directly to the corresponding anchor, e.g. B. by scrolling .

Reference to a jump label in the same document is made with the fragment identifier pound sign # :

<a href="#Ankername">Link</a>

Reference to a jump label in another document ( „href“= "hypertext reference"):

<a href="seite.html#Ankername">Link</a>

Reference to a jump label in another document with parameters:

<a href="seite.php?name=value#Ankername">Link</a>

Web links

Individual evidence

  1. 12 Links - 12.2 The A element. In: HTML 4.01 Specification W3C Recommendation 24 December 1999. Dave Raggett, Arnaud Le Hors, Ian Jacobs, W3C Consortium, accessed October 9, 2008 .
  2. 2 Introduction to HTML 4 - 2.1.2 Fragment identifiers. In: HTML 4.01 1999. W3C, accessed October 9, 2008 .