What are HTML Links?
HTML links (hyperlinks) allow users to navigate between web pages, sections, or external resources using the anchor (<a>) tag.
Basic Syntax
HTMLRead-only
1
Common Link Types
| Type | Example | Description |
|---|---|---|
| External Link | <a href="https://google.com">Google</a> | Navigates to another website |
| Internal Link | <a href="/about.html">About</a> | Navigates within the same site |
| Anchor Link | <a href="#section1">Go to Section</a> | Scrolls to a specific section |
| Email Link | <a href="mailto:test@example.com">Send Email</a> | Opens email client |
Opening Links in New Tab
HTMLRead-only
1
Linking to Page Sections
HTMLRead-only
1
Using Images as Links
HTMLRead-only
1
Important Attributes
| Attribute | Purpose |
|---|---|
| href | Destination URL |
| target | Where to open link |
| title | Tooltip text |
| rel | Relationship (e.g., noopener) |
Best Practices
- Use meaningful link text (avoid 'click here')
- Use target="_blank" carefully
- Add rel="noopener noreferrer" for security
- Ensure links are accessible and descriptive
- Check for broken links regularly
Common Mistakes
- Using empty href (#) unnecessarily
- Not providing descriptive link text
- Forgetting alt text for image links
- Opening too many links in new tabs
Conclusion
HTML links are essential for navigation and user experience. Mastering links helps create connected and user-friendly websites.