Skip to main content

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.


html
<a href="URL">text or content</a>
PartPurpose
<a>The link's opening tag
hrefThe destination address (URL)
textWhat the user sees and clicks
</a>The closing tag

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>
html
<a href="files/report.pdf" download>Download the report</a>

The download attribute makes the browser download the file instead of opening it.

html
<a href="mailto:info@example.com">Send an email</a> <a href="tel:+12345678900">Call</a>

4. Useful attributes

AttributePurposeExample
hrefSpecifies the link's addresshref="https://example.com"
target="_blank"Opens the link in a new tab<a href="..." target="_blank">
titleTooltip 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">
downloadDownloads 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.


html
<a href="https://example.com" target="_blank" rel="noopener noreferrer" title="Opens in a new tab"> Go to the site → </a>

Summary:

ParameterValue
Tag<a>
Main attributehref: the destination address
PurposeCreates a hyperlink between documents or elements
Additional featuresOpening in a new tab, downloading, anchors, e-mail, phone
Use casesNavigation, 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 ready
Premium

A concise answer to help you respond confidently on this topic during an interview.