HTML Link Tag Tutorial & Examples

A comprehensive tutorial on creating hyperlinks in HTML using the anchor (<a>) element, target attributes, email links, phone links, and SEO rel attributes.

The HTML Anchor Element (<a>)

In HTML, hyperlinks are created using the anchor element: <a>. The most important attribute of the anchor tag is href (hypertext reference), which specifies the destination URL or target of the link.

Basic Syntax

<a href="https://www.example.com">Visit Example.com</a>

Target Attribute: Opening in a New Tab

By default, links open in the current browser window or tab. Use the target="_blank" attribute to instruct the browser to open the destination link in a new window or tab. Whenever using target="_blank", always add rel="noopener noreferrer" for security and performance benefits:

<a href="https://www.rapidtables.online" target="_blank" rel="noopener noreferrer">RapidTables Online (New Tab)</a>

Target Attribute Values

Value Description
_selfDefault. Opens the linked document in the same frame/window as it was clicked.
_blankOpens the linked document in a new window or tab.
_parentOpens the linked document in the parent frame.
_topOpens the linked document in the full body of the current window.

Anchor Jumps (Bookmark Links)

You can create links that jump directly to a specific section on the current page or another page by targeting an element's id with a hashtag (#):

<!-- The link --> <a href="#section2">Jump to Section 2</a> <!-- Destination target --> <h2 id="section2">Section 2: Deep Dive</h2>

Email Links (mailto) & Phone Links (tel)

Use the mailto: protocol to open the visitor's default email client, and the tel: protocol to trigger dialing on mobile phones:

<!-- Email Link --> <a href="mailto:support@rapidtables.online?subject=Feedback">Email Us</a> <!-- Telephone Call Link --> <a href="tel:+18005550199">Call Support: 1-800-555-0199</a>

Downloadable File Links

Add the download attribute to force the browser to trigger a file download instead of navigating to the file:

<a href="/assets/downloads/sample-guide.pdf" download="RapidTables-Guide.pdf">Download PDF Guide</a>
Need to generate custom link code visually?
Use our interactive HTML Link Code Generator to configure target, rel, download, and copy ready-to-paste HTML instantly.