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
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:
Target Attribute Values
| Value | Description |
|---|---|
| _self | Default. Opens the linked document in the same frame/window as it was clicked. |
| _blank | Opens the linked document in a new window or tab. |
| _parent | Opens the linked document in the parent frame. |
| _top | Opens 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 (#):
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:
Downloadable File Links
Add the download attribute to force the browser to trigger a file download instead of navigating to the file:
Use our interactive HTML Link Code Generator to configure target, rel, download, and copy ready-to-paste HTML instantly.