The anchor element (<a>) creates hyperlinks — the connections that make the web a web. Its href attribute sets where the link goes.
Kinds of links
<a href="https://example.com">External site</a><a href="/about">Another page (relative path)</a><a href="#section2">Jump to a section on this page</a><a href="mailto:hi@example.com">Send an email</a><a href="tel:+911234567890">Call us</a><a href="doc.pdf" download>Download a file</a>
Opening in a new tab
Key takeaways
- 01The <a> element with href creates hyperlinks.
- 02href can be an external URL, a relative path, a #fragment, mailto:, or tel:.
- 03target="_blank" opens a new tab — add rel="noopener noreferrer" for security.
- 04Write descriptive link text, not "click here".
