What is a Link?
- A link is created using
<a>with thehrefattribute. hreftells the browser where to go.- Links can be external (full URL), internal (relative URL), or page jumps (like
#section).
Important Attributes
href: destination (URL,mailto:,tel:, or#id)target="_blank": opens in a new tabrel="noopener noreferrer": security best practice when usingtarget="_blank"- Use clear link text (avoid “click here”). Good: Read the HTML guide.
Links Example
HTML Links Examplehtml
<!-- Basic link -->
<a href="https://example.com">Visit Example</a>
<!-- Open in new tab (security best practice: rel) -->
<a href="https://example.com" target="_blank" rel="noopener noreferrer">
Open in new tab
</a>
<!-- Internal link (relative URL) -->
<a href="/tutorials/html">Go to HTML tutorials</a>
<!-- Email & phone links -->
<a href="mailto:hello@w3camp.com">Email us</a>
<a href="tel:+12025550123">Call us</a>
<!-- Jump link (same page) -->
<a href="#tips">Skip to tips</a>Preview
localhost:3000
Loading preview...
Best Practice: For external links that open in a new tab (target="_blank"), always include rel="noopener noreferrer" for security.