A hyperlink is a reference in a document that a user can activate to navigate to another resource or location, and in HTML it is created primarily with the anchor element (a) and its href attribute. Hyperlinks are the mechanism that turns separate documents into the interconnected web, because every page can point to any other addressable resource by its URL.
On the Web, a hyperlink carries more than a destination. It also has link text that tells people and search engines what to expect, optional relationship metadata such as rel, and behavior that browsers, assistive technologies and crawlers interpret in standardized ways defined by the HTML Living Standard.
How a hyperlink works in HTML
A hyperlink works by pairing a clickable element with a target address that the browser resolves and loads when the link is activated. The minimal form is <a href="/pricing">Pricing</a>, where the href value is the target and the enclosed content is the accessible name of the link.
When a user clicks, taps or presses Enter on a focused link, the browser resolves the URL against the document base, applies any target and rel rules, and starts a navigation. An a element without href is only a placeholder: it is not focusable by default and does not behave as a link.
The table below lists the main parts of an anchor element and their role.
| Component | Example | Purpose |
|---|---|---|
| href attribute | href="/docs/setup" | Defines the destination URL |
| Link text | Setup guide | Describes the destination to users |
| target attribute | target="_blank" | Chooses the browsing context |
| rel attribute | rel="noopener" | States the relationship to the target |
| download attribute | download="report.pdf" | Requests a file download |
| hreflang attribute | hreflang="de" | Indicates the target language |
Types of hyperlinks and their targets
Hyperlinks differ by what kind of address they use and where they lead. The distinction matters for maintenance, because relative links survive domain changes while absolute links remain valid when content is copied elsewhere.
| Type | Example href | Typical use |
|---|---|---|
| Absolute URL | https://example.org/about | Links to external sites |
| Root-relative URL | /blog/ | Internal links on the same site |
| Document-relative URL | ../images/map.html | Links within a folder structure |
| Fragment link | #installation | Jumps to an element with that id |
| Email link | mailto:support@example.org | Opens the default mail client |
| Telephone link | tel:+15551234567 | Starts a call on mobile devices |
A fragment identifier points to an element whose id matches the text after the hash sign, which makes it the standard technique for tables of contents and skip links. Modern browsers also support text fragments, which highlight a quoted passage in the target page, although support and behavior still vary between engines.
Hyperlinks compared with related HTML features
A hyperlink is meant for navigation, and several other HTML features look similar but serve different purposes. Confusing them harms accessibility, because assistive technologies announce each control by its role.
| Feature | Primary purpose | When to choose it |
|---|---|---|
| Anchor with href | Navigate to a URL | The user goes somewhere new |
| Button element | Trigger an action | The user submits, opens or toggles |
| Link element in head | Declare document relationships | Stylesheets, canonical, preload |
| Form submission | Send data to a server | Search, login, checkout |
| Image map area | Link regions of an image | Clickable diagrams or maps |
The key rule is simple: use a link to change the URL and use a button for actions. Styling a div with a click handler to imitate a link removes keyboard focus, the context menu and the ability to open the target in a new tab. An a element is an inline element by default, although in HTML5 it may wrap block content such as a whole card.
The rel attribute, security and search engines
The rel attribute tells browsers and crawlers how the current page relates to the linked resource. Several values have direct effects on security, privacy and search ranking, so they are part of everyday web development rather than optional extras.
| Value | Effect | Typical context |
|---|---|---|
| noopener | Blocks access to window.opener | Links opening a new tab |
| noreferrer | Omits the Referer header and implies noopener | Privacy-sensitive outbound links |
| nofollow | Asks crawlers not to pass ranking signals | Untrusted or unendorsed links |
| sponsored | Marks paid or affiliate links | Advertising and partnerships |
| ugc | Marks user-generated content | Comments and forum posts |
Opening a page with target="_blank" once exposed the original tab to reverse tabnabbing, in which the new page could redirect its opener. Current browsers apply noopener by default for such links, yet adding it explicitly remains good practice for older clients. For search engines, descriptive anchor text is a strong relevance signal, while generic text such as “click here” gives neither users nor crawlers useful context.
Accessibility and usability of hyperlinks
An accessible hyperlink makes its purpose clear from the link text alone or from its immediate context, as required by WCAG success criterion 2.4.4. Screen reader users often browse a page as a list of links, so ten links reading “read more” become indistinguishable.
- Write descriptive link text that names the destination or result.
- Keep a visible focus indicator so keyboard users know where they are.
- Do not rely on color alone to mark links inside body text; an underline is the clearest cue.
- Warn users about new tabs or downloads, for example by noting the file type and size.
- Provide adequate target size, particularly on touch screens.
Images used as links need meaningful alternative text that describes the destination, not the picture. A logo linking to the home page, for instance, should announce the site name and home page rather than “logo”.
Common hyperlink mistakes and maintenance
Hyperlinks decay over time because target pages move or disappear, a problem known as link rot. Regular link checking, permanent redirects with HTTP status 301 and stable URL design keep a site navigable and protect its search visibility.
Other frequent errors include using href="#" with JavaScript for actions, which should be buttons, and nesting interactive elements inside a link, which the specification forbids. Breaking the back button with scripted navigation and hiding destinations behind tracking redirects also reduce user trust.
The idea in brief
A hyperlink is the clickable text or image that takes you from one page to another. It works like a signpost: the words tell you where it leads, and the hidden address behind it tells the browser exactly where to go.
Every time you click a blue underlined word, open a menu item or jump to a section further down a page, you are following a hyperlink. Links are what connect separate pages into one web, and good links always make clear where you will end up.
A practical scenario
A university library redesigns its research guides, which contain about 1,200 links to databases, journals and internal help pages. An audit with a link checker finds that 14 percent of links are broken and that many use the text “click here”, which screen reader users report as confusing.
The web team rewrites link text to name each resource, replaces hard-coded absolute addresses for internal pages with root-relative paths, and adds rel="noopener" to links that open external databases in new tabs. Long guides gain a table of contents built from fragment links to each heading.
After the update, broken links fall to under one percent, navigation tests with keyboard users succeed without assistance, and the team schedules a monthly automated check. The result is a more reliable and accessible set of guides that requires far less manual correction.