An Introduction to HTML Link

HTML links are also known as hyperlinks. When we click on particular links on web pages, they open other web pages. A link does not have to be a text—it can be an image or any other HTML element. It is an integral part of HTML and it is used everywhere.

In this article, we will cover the following: 

  • What is an HTML link?
  • HTML links: the target attribute
  • Use an image as a link
  • Setting link colors
  • Linking to an email address 

What is an HTML link?

An HTML link is used to link other web pages to a document. When users click on links on web pages, they are brought to other web pages or websites. An HTML document contains many links, which are also known as hyperlinks. Web developers can link from the text, images, and other types of media.Links are specified in HTML using <a> tags.

<a href=”url” > Text Link </a>

The href attribute is used to specify the link’s destination.

The test link is the visible part of the link.

html-link

This will produce the following result—when you click on the link, it will take you to the Simplilearn homepage.

output-html-link

Full Stack Java Developer Course

The Gateway to Master Web DevelopmentExplore Course
Full Stack Java Developer Course

HTML links - The Target Attribute

The target attribute of HTML links specifies where to open the linked document. The following are possible options:

_blank

Opens the linked document in a new window or tab

_self

Opens the linked document in the same window or tab

_parent

Opens the document in the parent frame

_top

Opens the linked document in the full body of the window

target-attribute

This will produce the following result. Click on the links to see the difference.

output-target-attribute

Use an Image as a Link

You can also link an image to another web page. To do this, put the <img> tag inside an <a> tag.

image-as-link.

This will produce the following result:

output-image-as-link

When you click on the image, you will be directed to the Simplilearn website.

Setting Link Colors

By default, links will appear as follows:

  • An unvisited link will be underlined and blue
  • A visited link is underlined and purple
  • An active link is underlined and red

With CSS, web developers have the option of customizing these link colors.

link-colors-html-links

Link to an Email Address

You can create a link on your web page, which will navigate the user to their system’s default email program using mailto: inside the href attribute.

<a href="mailto:someone@example.com">Send email</a>

When you will click on the “send email” link, you will be directed to your email account.

output-mailto

Get skilled in HTML5 and CSS3 with the Full Stack Java Developer Master's Program. Click to check out the program details!

Would You Like to Become a Full-Stack Developer?

Our brief introduction to HTML links covered the basics when it comes to creating and customizing website hyperlinks. We discussed several ways in which we can manipulate the properties of hyperlinks with CSS and coding. When it comes to learning HTML, however, this is just the tip of the iceberg. If you’re serious about taking the next step to advancing your career, certification is highly recommended in today’s competitive job market. Simplilearn’s Full Stack Java Developer course is a comprehensive program that will teach you everything you need to know to master web development Upon completion, students also earn their certifications, which can help them gain an edge over the competition.

If you’re an aspiring web and mobile developer, HTML training will broaden your skills and career opportunities. 

Do you have any questions for us? Please leave them in the comments section, and we'll have our experts answer them for you.

About the Author

Aryan GuptaAryan Gupta

Aryan is a tech enthusiast who likes to stay updated about trending technologies of today. He is passionate about all things technology, a keen researcher, and writes to inspire. Aside from technology, he is an active football player and a keen enthusiast of the game.

View More
  • Disclaimer
  • PMP, PMI, PMBOK, CAPM, PgMP, PfMP, ACP, PBA, RMP, SP, and OPM3 are registered marks of the Project Management Institute, Inc.