<w> smolweb

a: The Anchor element

The <a> HTML element (or anchor element), with its href attribute, creates a hyperlink to web pages, files, email addresses, locations in the same page, or anything else a URL can address.

Content within each <a> should indicate the link’s destination. If the href attribute is present, pressing the enter key while focused on the <a> element will activate it.

Attributes

Specific attributes

Recommended attributes

href="[URL]" the URL that the hyperlink points to. Links are not restricted to HTTP-based URLs — they can use any URL scheme supported by browsers:

Allowed attributes

download="[filename]" causes the browser to treat the linked URL as a download. Can be used with or without a filename value. The filename will be proposed to save the file locally.

hreflang="[lang]" hints at the human language of the linked URL. Allowed values are defined by RFC 5646

rel="[relationship]" specifies the relationship between the current document and the linked document.

target="[target value]" Where to display the linked URL, as the name for a browsing context (a tab, window). The following keywords have special meanings for where to load the URL:

type="[mime type]" Hints at the linked URL’s format with a MIME type.

Global attributes

accesskey Specifies a keyboard shortcut to activate or focus an element.

aria-* Defines accessibility properties and states for assistive technologies.

class Specifies one or more CSS class names for styling the element.

data-* Stores custom data private to the page or application.

dir Sets the text direction (left-to-right, right-to-left, or auto).

hidden Hides the element from display and assistive technologies.

id Defines a unique identifier for the element within the document.

inputmode Hints which virtual keyboard type to display on mobile devices.

itemid Provides a global identifier for microdata items.

itemprop Defines a property name-value pair for microdata.

itemref Associates properties with an item via element IDs for microdata.

itemscope Creates a new microdata item container.

itemtype Specifies the vocabulary URL for microdata items (like Schema.org).

lang Specifies the primary language of the element’s content.

nonce Provides a cryptographic nonce for Content Security Policy.

role Defines the element’s semantic role for accessibility.

tabindex Controls keyboard navigation order and focusability.

title Provides advisory information displayed as a tooltip.

Example

<a href="https://smolweb.org" target="_blank" referrerpolicy="origin">SmolWeb</a>