Name

a — HTML 4.01 | HTML5

Synopsis

<a> . . . </a>

Defines an anchor that can be used as a hypertext link or a named fragment within the document. When the href attribute is set to a valid URI, the anchor is a hypertext link to a web page, page fragment, or another resource. The name or id attributes are used to label an anchor and allow it to serve as the destination point of a link. An a element may have both href and name/id attributes.

Notes

In HTML5, the href attribute may be omitted to use an a element as a “placeholder link.” HTML5 also permits flow content (block elements) within a elements.

Start/End Tags

Required/Required

Attributes

Core, Internationalization, Events, Focus, HTML5 Global Attributes

charset="charset"

Not in HTML5. Specifies the character encoding of the target document.

coords="x,y coordinates"

Not in HTML5. Specifies the x/y-coordinates for a clickable area in an image map. The HTML 4.01 Recommendation proposes that client-side image maps be replaced with an object element containing the image and a set of anchor elements defining the “hot” areas (with shapes and coordinate attributes). This system has not been implemented by browsers and has been dropped in HTML5.

href="URI"

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

hreflang="language code"

Specifies the base language of the target document.

id="text"

Gives the link a unique name (similar to the name attribute) so that it can be referenced from ...

Get HTML & XHTML Pocket Reference, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.