HTML Basics

HTML Introduction HTML Basic HTML Comments HTML Tags/Elements HTML Attributes HTML Formatting HTML Block and Inline HTML Charsets HTML Classes HTML Colors HTML Div HTML Headings HTML Id HTML Iframes HTML Images HTML File Paths HTML Tables HTML Layout HTML Lists HTML Links <a> HTML Paragraphs HTML Quotations HTML JavaScript HTML Emojis HTML URL Encode HTML Entities HTML Computercode HTML Symbols HTML Styles

HTML Forms

HTML Forms HTML Form Elements HTML Form Attributes HTML Input Attributes HTML Input Regex HTML Input Form Attributes HTML Input Types

HTML SEO

HTML Head HTML Page Title HTML Responsive HTML Semantics HTML Favicon

HTML Graphics

HTML Canvas HTML SVG

HTML Media

HTML Media HTML Audio HTML Video

HTML Reference

a abbr acronym address applet area article aside audio b base basefont bdi bdo big blockquote body br button canvas caption center cite code col colgroup data datalist dd del details dfn dialog dir div dl DOCTYPE dt em embed fieldset figcaption figure font footer form frame frameset h1_-_h6 head header hgroup hr html i iframe img input ins kbd label legend li link main map mark menu meta meter nav noframes noscript object ol optgroup option output p param picture pre progress q rp rt ruby s samp script search section select small source span strike strong style sub summary sup svg table tbody td template textarea tfoot th thead time title tr track tt u ul var video wbr

Understanding the HTML <a> Tag

The <a> tag, commonly known as the anchor tag, is used to create links between different pages, within the same page, or to any location on the internet. It's one of the fundamental components of the web, facilitating navigation and connectivity between resources.

Basic Usage of the <a> Tag

The <a> tag uses the href attribute to specify the URL of the page the link goes to:

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

This example creates a link to the homepage of "www.example.com". When clicked, it will take the user directly to that URL.

Main Attributes of the <a> Tag

Attribute Description
href Specifies the URL of the page the link goes to.
title Provides additional information about the link, usually shown as a tooltip when the mouse hovers over the link.
target Defines where to open the linked document (in a new tab, in the same tab, etc.).
rel Specifies the relationship between the current document and the linked document.

Values for the target Attribute

Value Description
_blank Opens the linked document in a new window or tab.
_self Opens the linked document in the same frame as it was clicked (this is default).
_parent Opens the linked document in the parent frame.
_top Opens the linked document in the full body of the window.

Using the <a> Tag for Email Links

You can also use the <a> tag to create an email link using the mailto: protocol:

<a href="mailto:example@example.com">Send Email</a>

This link, when clicked, will open the user's default email program with the "To" field already filled out with "example@example.com".

Conclusion

The <a> tag is a versatile tool in HTML, essential for creating hyperlinks. Understanding its attributes and how they work can greatly enhance the usability and functionality of your web pages, providing a better user experience through effective navigation and linking strategies.