Links in HTML
? Links in HTML
Links are essential in HTML to navigate between webpages, files, or resources. They are created using the <a> (anchor) tag.
Basic Syntax of a Link
<a href="URL">Link Text</a>href: Specifies the URL of the page the link goes to.The text between
<a>and</a>is clickable.
Examples
Link to another webpage
<a href="https://www.example.com">Visit Example</a>Link to a section within the same page (Anchor link)
<a href="#section1">Go to Section 1</a><!-- Later in the page --><h2 id="section1">Section 1</h2>Link to an email address
<a href="mailto:someone@example.com">Send Email</a>Open link in a new tab
<a href="https://www.example.com" target="_blank">Open in new tab</a>Important Attributes
| Attribute | Description |
|---|---|
href | URL or location the link points to |
target | Where to open the linked document (_self, _blank) |
rel | Relationship between current and linked document (e.g., noopener, nofollow) |
title | Additional info shown on hover |
Accessibility Tips
Use meaningful link text (avoid "click here").
Use
rel="noopener"when usingtarget="_blank"for security.
Would you like examples of styled links or how to create navigation menus?