What is a link (hyperlink) in HTML?
A link (hyperlink) in HTML is an element that lets you go from one page to another, or perform an action (for example, open a file, go to an e-mail, jump to an anchor, and so on).
Links are created using the <a> tag (anchor - "anchor point").
1. Simplest example
html
<a href="https://example.com">Go to the site</a>What's here:
<a>: the link tag;href: (Hypertext REFerence) the address the link points to;- the text inside (
Go to the site): what can be clicked.
On click, the browser opens the specified address.
2. Link structure
html
<a href="URL">text or content</a>| Part | Purpose |
|---|---|
<a> | The link's opening tag |
href | The destination address (URL) |
text | What the user sees and clicks |
</a> | The closing tag |
3. Types of links
External link:
html
<a href="https://google.com">Google</a>Opens another page or site.
Internal (to another page of the site):
html
<a href="/about.html">About us</a>Anchor (jump to part of the page):
html
<a href="#contacts">Contacts</a>
<section id="contacts">...</section>Link to a file:
html
<a href="files/report.pdf" download>Download the report</a>The download attribute makes the browser download the file instead of opening it.
Link to email or phone:
html
<a href="mailto:info@example.com">Send an email</a>
<a href="tel:+12345678900">Call</a>4. Useful attributes
| Attribute | Purpose | Example |
|---|---|---|
href | Specifies the link's address | href="https://example.com" |
target="_blank" | Opens the link in a new tab | <a href="..." target="_blank"> |
title | Tooltip shown on hover | <a title="Go to the site"> |
rel="noopener noreferrer" | Protection when opening in a new tab (recommended with _blank) | <a target="_blank" rel="noopener noreferrer"> |
download | Downloads the file | <a href="file.pdf" download> |
5. Inside <a> you can place more than just text
html
<a href="https://example.com">
<img src="button.png" alt="Button">
</a>The picture itself becomes clickable.
6. Example of a complex link
html
<a href="https://example.com" target="_blank" rel="noopener noreferrer" title="Opens in a new tab">
Go to the site →
</a>Summary:
| Parameter | Value |
|---|---|
| Tag | <a> |
| Main attribute | href: the destination address |
| Purpose | Creates a hyperlink between documents or elements |
| Additional features | Opening in a new tab, downloading, anchors, e-mail, phone |
| Use cases | Navigation, buttons, links, menus, calls to action |
In simple terms:
<a> is a bridge between pages.
It tells the browser:
"If the user clicks here, go to this address."
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.