html
/

HTML Links: Creating Hyperlinks in Web Pages

Last Sync: Today

On this page

10
0%
5 min read
Remaining
5 minleft

Click any section to jump — progress syncs automatically

html

HTML Links: Creating Hyperlinks in Web Pages

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
<a href="https://example.com">Visit Website</a>

Common Link Types

TypeExampleDescription
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
<a href="https://example.com" target="_blank">Open in New Tab</a>

Linking to Page Sections

HTMLRead-only
1
<a href="#contact">Go to Contact</a>

<h2 id="contact">Contact Section</h2>

Using Images as Links

HTMLRead-only
1
<a href="https://example.com">
  <img src="image.jpg" alt="Click here">
</a>

Important Attributes

AttributePurpose
hrefDestination URL
targetWhere to open link
titleTooltip text
relRelationship (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.

Try it yourself

<a href="https://google.com" target="_blank">Open Google</a>

Test Your Knowledge

Q1
of 3

Which tag is used for links?

A
<link>
B
<a>
C
<href>
D
<url>
Q2
of 3

Which attribute defines the URL?

A
src
B
href
C
link
D
url
Q3
of 3

Which value opens a link in a new tab?

A
_self
B
_parent
C
_blank
D
_top

Frequently Asked Questions

What is the <a> tag?

It is used to create hyperlinks in HTML.

What does target="_blank" do?

It opens the link in a new tab.

Can I link to a specific section?

Yes, using anchor links with IDs.

Previous

html formatting

Next

html lists

Related Content

Need help?

Explore our comprehensive docs or start a chat with our tech experts.