Anchor tags are used in HTML to create links. These links allow users to move from one page to another, open websites, send emails, or navigate within the same page.
What is an Anchor Tag
The anchor tag is written as <a>. It is one of the most important tags in HTML because it connects web pages together and helps users navigate the internet.
Basic Structure
The anchor tag uses the href attribute to define the destination of the link.
Example of Anchor Tag
<a href=”https://example.com”>Visit Website</a>
Internal Links
Internal links are used to connect different pages within the same website.
Example of Internal Link
<a href=”about.html”>About Us</a>
External Links
External links are used to open other websites.
Example of External Link
<a href=”https://google.com”>Go to Google</a>
Email Links
Anchor tags can also be used to send emails using mailto.
Example of Email Link
<a href=”mailto:info@example.com”>Send Email</a>
Phone Links
You can also create clickable phone numbers using tel.
Example of Phone Link
<a href=”tel:+1234567890″>Call Us</a>
Summary
Anchor tags are used to create links in HTML. They help users navigate between pages, open external websites, send emails, and make phone calls directly from a webpage.