Skip to content

WebDevHubs

  • Home
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • Java
  • Selenium
  • PHP
  • Python
  • Programs
  • Toggle search form

How to Create a Hyperlink in HTML?

Posted on July 22, 2025July 22, 2025 By Admin No Comments on How to Create a Hyperlink in HTML?

To create a hyperlink in HTML, use the <a> (anchor) tag. This element makes any enclosed text, image, or other HTML content clickable and navigational. The most important attribute of the <a> tag is href, which specifies the destination of the link.

Basic Syntax

<a href="URL">Link Text</a>

Where –

  • href: The URL or path where the link should point.
  • Link Text: The visible clickable text.

Example:

<a href="https://www.webdevhubs.com">Visit WebDevHubs</a>

Clicking “Visit WebDevHubs” will take the user to https://www.webdevhubs.com.

Opening the Link in a New Tab or Window

Use the target attribute:

  • _self: Opens in the same window/tab (default).
  • _blank: Opens in a new window or tab.

Example:

<a href="https://www.webdevhubs.com" target="_blank">Open in New Tab</a>

This link will open the page in a new tab or window.

Adding a Tooltip

Add the title attribute for extra information shown on hover:

<a href="https://www.webdevhubs.com" title="Go to WebDevHubs Site">Visit WebDevHubs</a>

Linking to Email and Phone

Email:

<a href="mailto:someone@webdevhubs.com">Send Email</a>

Phone:

<a href="tel:+1234567890">Call Now</a>

Linking Within the Same Page (Bookmarks)

Give the destination element an id:

<h2 id="section2">Section 2</h2>

Link to that ID:

<a href="#section2">Go to Section 2</a>

Common Tips

  • The clickable anchor text should be descriptive (e.g., “Learn More About HTML” rather than “Click here”), which helps both visitors and search engines understand the link’s destination.
  • Links can also wrap around images or other HTML elements, not just text.

Full Example

<!DOCTYPE html>
<html>
  <head>
    <title>HTML Hyperlink Example</title>
  </head>
  <body>
    <h2>Basic Link</h2>
    <a href="https://www.w3schools.com">Visit W3Schools</a>

    <h2>Open Link in New Tab</h2>
    <a href="https://www.example.com" target="_blank">Open Example in New Tab</a>

    <h2>Email Link</h2>
    <a href="mailto:info@example.com">Email Us</a>

    <h2>Phone Link</h2>
    <a href="tel:+11234567890">Call Us</a>

    <h2>Jump Within the Page</h2>
    <a href="#contact">Go to Contact Section</a>
    <!-- ...other content... -->
    <h3 id="contact">Contact Section</h3>
    <p>Here is the contact section.</p>
  </body>
</html>

This demonstrates how to use hyperlinks in HTML to navigate to other web pages, send emails or calls, and jump to sections within the same page.

HTML, Web Technologies Tags:html-Questions

Post navigation

Previous Post: How to Link CSS to HTML?
Next Post: How to Create a Webpage using HTML?

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • CSS
  • HTML
  • Interview Experience
  • Java
  • JavaScript
  • Lodash
  • PHP
  • Programs
  • Python
  • Selenium
  • Software Testing
  • Web Technologies
  • Web Templates

Recent Posts

  • Java ArrayList trimToSize() Method
  • Java ArrayList toArray() Method
  • Java ArrayList subList() Method
  • Java ArrayList spliterator() Method
  • Java ArrayList sort() Method

Recent Comments

No comments to show.

Important Pages

  • About Us
  • Contact Us
  • Terms of Use
  • Privacy Policy

Web Development

  • HTML
  • CSS
  • JavaScript
  • PHP

Programming Languages

  • Java
  • Python
  • PHP
  • Programs

Others

  • Selenium
  • Lodash
  • Java ArrayList
  • JavaScript Array Methods

Copyright © 2025 WebDevHubs.

Powered by PressBook Green WordPress theme