SyntaxStudy
Sign Up
HTML Beginner 1 min read

HTML Links

HTML Links

Links are created with the <a> (anchor) tag. The href attribute holds the URL.

Types of Links

  • Absolute URL — Full address: https://example.com/page
  • Relative URL — Relative to current page: about.html
  • Emailmailto:name@example.com
  • Phonetel:+1234567890
  • Anchor — Jump to section: #section-id

The target Attribute

target="_blank" opens link in a new tab. Always pair it with rel="noopener noreferrer" for security.

Example
<a href="https://learncode.com">Visit LearnCode</a>
<a href="about.html">About Page (relative)</a>
<a href="https://google.com" target="_blank" rel="noopener noreferrer">
  Open Google in new tab
</a>
<a href="mailto:hello@example.com">Email Us</a>
<a href="#contact">Jump to Contact</a>

<section id="contact">
  <h2>Contact</h2>
</section>