XML technologies / HTML & XHTML / Alphabetical list of HTML and XHTML elements / a

(Excerpt from "HTML & XHTML ─ kurz & gut" by Jennifer Niederst Robbins)

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

   

 

HTML 4.01 | HTML 5

a

<a> ... </a>

Defines an anchor used as a hypertext link or to name a document fragment. If the attribute href contains a valid URI, the anchor is a hypertext link to a web page, a document fragment or another resource. The attributes id or name identify the anchor so that it can serve as a link target. An element can have both href and id/name attributes.

Notes

In HTML 5, the href attribute can be omitted to use an a element as a placeholder link. HTML 5 also allows flow content (block elements).

Start/end tag

Required/required

Attributes

Core, internationalization, events, focus, global HTML 5 attributes

  • charset="Zeichenkodierung"

    Not available in HTML 5. Specifies the target document’s character encoding.

  • coords="x,y Koordinaten"

    Not available in HTML 5. Defines the x/y coordinates of a clickable image map region. HTML 4.01 proposes replacing a client-side image map with an object element containing the image and anchors defining its active regions through shape and coordinate attributes. Browsers did not implement this system, and it was removed from HTML 5.

  • href="URI"

    Specifies the location of the target document or web resource, such as an image, audio file, PDF or other media file.

  • hreflang="Sprachcode"

    Specifies the target document’s primary language.

  • id="Text"

    Gives the link a unique name, similarly to the attribute name, allowing links or stylesheets to reference it. XHTML requires the attribute id to identify document fragments. For backward compatibility, authors use the attributes name and id together to identify individual document fragments.

  • media="all|aural|braille|handheld|print|projection|screen|tty|tv"

    HTML 5 only. Describes the medium for which the target document was created. The default is all.

  • name="Text"

    Not available in HTML 5. XHTML documents use id to identify document fragments. Places a fragment identifier, or anchor, in an HTML document.

  • ping="URLs"

    HTML 5 only. Defines URLs to contact when the link is clicked. Useful for collecting user statistics.

  • rel="link Linktyp-Schlüsselwort"

    Defines a relationship between the source and target documents. Link types defined in both HTML 4.01 and HTML 5 are: alternate, bookmark, help, index, next and prev. Keywords valid only in HTML 4.01 include: appendix, chapter, contents, copyright, glossary, section, start and subsection. The following link types are valid only in HTML 5: archives, author, external, first, last, license, nofollow, noreferrer, search, sidebar, tag and up.

  • rev="Linktyp-Schlüsselwort"

    Not available in HTML 5. Specifies one or more relationships from the target document back to the source document (the reverse of the attribute rel).

  • shape="rect|circle|poly|default"

    Not available in HTML 5. Defines the shape of a clickable image map region. This is part of the HTML 4.01 recommendation to replace client-side image maps with a combination of object and a elements. Browser implementation was insufficient, so HTML 5 dropped this system.

  • target="Text"

    Specifies the name of the window or frame displaying the target document.

  • type="MIME-Typ"

    Specifies the target document’s media or content type (MIME type), for example text/html.

Examples

Link to a local file:

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

Link to an external file:

<a href="http://server/pfad/datei.html">...</a>

Link to a named anchor (fragment):

<a href="http://server/pfad/datei.html#fragment">...</a>

Link to a named anchor in the current document:

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

Link for sending an email message:

<a href="mailto:benutzername@domain">...</a>

Link to a file on an FTP server:

<a href="ftp://server/pfad/dateiname">...</a>

Creating a named anchor in HTML:

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

Creating a named anchor in XHTML. Some authors also use a name attribute to maintain backward compatibility with older browsers.

<a id="fragment">...</a>

 

> back to the alphabetical list of elements

   

 

 

 

back to top