The <a> Element
Technical Summary
An a element with an href attribute represents a hyperlink labeled by its descendant content. Without href, it represents a placeholder where a link might otherwise be placed.
The presence of the href attribute is a condition that changes the element's semantics, its interactive-content classification, and the entry point for its activation behavior.
Definition / Variants
| Condition | Meaning | Main consequence |
|---|---|---|
href present | Hyperlink | Creates a user-followable link and is classified as interactive content |
href absent | Placeholder | Does not create a hyperlink and is not interactive content |
The condition is whether the href attribute node is present. It should not be reduced to a simple test for a non-empty string. When present, the value must be a valid URL, potentially surrounded by spaces.
Content model
- The content model is transparent.
- However, an
aelement must not have interactive content descendants. - With
href, it is phrasing content and interactive content. - Without
href, it is not interactive content.
As a result, putting another link or a button inside a link creates a semantic problem even if a browser appears to handle the markup.
Main attributes and conditions
| Attribute | Role | Point to verify |
|---|---|---|
href | Hyperlink URL | Its presence selects the element variant |
target | Navigable target | Processed as a target name or keyword |
download | Intent to download | Affects activation processing |
rel | Relationship to the destination | Includes link types such as noopener and noreferrer |
ping | Hyperlink-auditing notification targets | A space-separated set of HTTP(S) URLs |
hreflang / type | Advisory language and MIME-type metadata | Neither is authoritative for the fetched resource |
referrerpolicy | Referrer policy for following the link | Connects the element to Fetch and Referrer Policy processing |
Activation behavior
For an a or area element, activation first returns if there is no href. If download is present, the user agent downloads the hyperlink; otherwise it follows the hyperlink.
if href is absent:
return
if download is present:
download the hyperlink
else:
follow the hyperlink
Describing an a element merely as “an element that fires a click event” misses its URL, navigable, user-involvement, and download processing model.
DOM API
The a element is exposed as HTMLAnchorElement and can use the hyperlink URL API. Properties such as origin, protocol, host, pathname, search, and hash represent parts of the element's associated URL.
const link = document.querySelector('a');
link.href;
link.origin;
link.pathname;
link.hash;
Fact / Evidence
Key facts are mapped to their conditions, review status, and evidence locations. Unresolved scope remains visible in the Coverage section below.
| Type | Fact | Condition / Scope | Status | Evidence |
|---|---|---|---|---|
| SPEC | An a element with href represents a hyperlink. | The href attribute node is present. | Reviewed | HTML Standard: links created by a and area |
| SPEC | Without href, an a element is a placeholder and is not interactive content. | The href attribute node is absent. | Reviewed | HTML Standard: interactive content |
| SPEC | A linked a element must not contain interactive-content descendants. | href is present; the transparent content model still applies. | Reviewed | HTML Standard: interactive content |
| SPEC | Activation follows the hyperlink, or downloads it when the download branch applies. | href is present; navigation and download are separate processing branches. | Reviewed | HTML Standard: following hyperlinks |
Evidence
- HTML Standard: 4.6 Links — hyperlinks created by a/area, attributes, activation behavior, and hyperlink APIs
- HTML Standard: Content models — shared definitions for content models and categories
- HTML Standard: Interactive content — interactive-content classification
Implementation Evidence
Implementation observations are recorded separately from normative claims. Pending means that no implementation result is claimed yet.
Shared fixture / environment: Minimal fixture with anchors with and without href, a relative /target.html URL, focus, click, and a dynamically inserted script. Chrome 152.0.0.0 / Windows NT 10.0 / checked 2026-09-13.
| Type | Reproducible scope | Record required | Status |
|---|---|---|---|
| IMPL | href="/target.html" resolved to http://127.0.0.1:8765/target.html while getAttribute retained the relative value. The anchor without href had an empty href property and no attribute. Both were constructed as HTMLAnchorElement; focus set activeElement to with-href, and click did not navigate after preventDefault(). | Chrome 152.0.0.0 / Windows NT 10.0 / 2026-09-13. URL resolution, APIs, focus, and activation were observed with the minimal fixture. | Reviewed |
| WPT | Tests related to hyperlink creation, activation, download, and target behavior | Mapped to htmlanchorelement_getter.html, htmlanchorelement_attribute-getter-setter.html, and activation-behavior.window.js. On 2026-09-15 in Chrome 152.0.0.0 / Windows NT 10.0, the two HTML tests passed 25/25 on wpt.live. activation-behavior.window.js could not be opened by the browser runner and remains unrun. | Partial (25/25 pass) |
| AAM | In the Chrome AX tree, the anchor with href was exposed as a link named “リンクあり”; the anchor without href was exposed as text without a link role. The linked anchor was also the focused target. | Chrome 152.0.0.0 / Windows NT 10.0 / 2026-09-13. Browser AX tree observation; no assistive technology claim. | Observed |
Use the WPT repository for test mapping and HTML-AAM for accessibility criteria.
Coverage / Open Issues
- CheckedElement semantics, href variants, main attributes, activation behavior, and DOM API
- OpenAll link types, the URL Standard, Fetch, and Referrer Policy require separate Topics
- OpenComplete ARIA and platform accessibility mapping
- OpenThis implementation and AX observation covers one Chrome environment only. Multi-browser comparison, WPT execution, historical changes, and compatibility data remain unregistered.
This page is initial coverage. It does not claim that every fact about the HTML a element has been verified.
Related surface
For a beginner-friendly minimal example and the distinction between links and buttons, see the a element page in Yugien. For button type states and form processing, see the button element in Atlas.