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
objectelement containing the image and anchors defining its active regions throughshapeandcoordinateattributes. 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 attributeidto identify document fragments. For backward compatibility, authors use the attributesnameandidtogether 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
idto 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,nextandprev. Keywords valid only in HTML 4.01 include:appendix,chapter,contents,copyright,glossary,section,startandsubsection. The following link types are valid only in HTML 5:archives,author,external,first,last,license,nofollow,noreferrer,search,sidebar,tagandup.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
objectandaelements. 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>
|
Copyright © 2010 O’Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from "HTML & XHTML ─ kurz & gut" is subject to the same provisions as the printed edition: the work, including all its parts, is protected by copyright. All rights are reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de