<a href="…"> creates a hyperlink. It can point to a page, a file, a fragment, or a URL scheme such as mailto:. A link navigates; a button performs an action.
Navigate to a real section
Tab to the link and press Enter. Its fragment points to the heading below, inside the isolated example.
HTML and CSS
HTML
<p><a href="#practice">Read the practice instructions</a></p>
<h2 id="practice">Practice</h2>
<p>Change one declaration and compare the result.</p>
CSS
a:focus-visible {
outline: 3px solid #2563eb;
outline-offset: 3px;
}
Edit HTML or CSS to update the preview as you type. Copy code snippet copies the selected tab. Preview spacing and font defaults are not included.
Attributes and content
Without href, a is a placeholder rather than an ordinary keyboard-activatable link. Its content follows the surrounding content model, but cannot include another a, interactive controls, or descendants with a specified tabindex. Do not wrap a button inside a linked card.
target="_blank" opens a new browsing context; tell readers when that happens. Modern browsers give blank-target links implicit noopener behavior, and explicit rel="noopener" can document intent. noreferrer additionally suppresses referrer information; it is not required for every external link.
download suggests downloading and optionally names the file; its behavior depends on origin, URL scheme, headers, and browser policy. It is not a command to download any cross-origin file.
Accessible navigation
Name the destination in visible text. For an image-only link, the image’s alt should describe the link’s purpose. Keep visible keyboard focus, and do not rely on title tooltips or href="#" placeholders. Use nav for major navigation groups. Preview links stay inside the sandbox and cannot navigate this article.
Sources and browser support
MDN: a describes the syntax and links to the specification and compatibility data. Check individual values in that table when supporting older browsers.