Hyperlinks in HTML are created using the <a> (anchor) tag. They allow users to navigate to another page, section, or resource when clicked.
Basic Syntax
<a href="URL">Link Text</a>
href→ URL or target location- Link Text → clickable text displayed on the page
Examples
- Link to an external website
<a href="https://www.example.com">Visit Example</a>
- Open link in a new tab
<a href="https://www.example.com" target="_blank">Visit Example</a>
- Link to a section on the same page
<a href="#contact">Go to Contact Section</a>
<section id="contact">
<h2>Contact Us</h2>
</section>
- Email link
<a href="mailto:someone@example.com">Send Email</a>
- Telephone link (mobile devices)
<a href="tel:+1234567890">Call Us</a>
Attributes Commonly Used with <a>
target→_blank(new tab),_self(same tab)rel→noopener noreferrer(security for_blank)title→ Tooltip textdownload→ Download the linked file
💡 In Short:
Use the
<a>tag with thehrefattribute to create clickable links that can navigate to other pages, sections, emails, or files.