Links

Links connect one page to another — or to another part of the same page. They're created with the anchor element, <a>.

Basic link

Try it yourself
Result

The href attribute (short for "hypertext reference") holds the destination URL — this is required for the link to actually go anywhere.

Absolute vs. relative links

An absolute link includes the full address, starting with https:// — it works no matter where it's placed. A relative link just points to another file within the same site:

Try it yourself
Result

Opening a link in a new tab

Add target="_blank" to open the link in a new browser tab instead of navigating away from the current page:

Try it yourself
Result
Note: use target="_blank" sparingly — taking someone to a new tab without warning can be disorienting if overused.