SwitchUp SwitchUp Ranked Best Coding Bootcamps 2025

Hyperlinks

Written in HTML CSS Development
updated on 12 Mar 2023

A very useful element in HTML is the hyperlink or anchor tag. You use it to link to another file, page, or website.
language=>HTML <a href="http://www.google.com">Google</a>
a stands for anchor and href is for Hypertext REFerence. The above creates a text Google that links to the Google website. You place the address of the page you want to link to as the value of the href attribute.


Anchor links are inline elements and you can nest them in other block or inline elements. If you have a paragraph and you want one of the phrases to link to somewhere else, enclose the phrase in an anchor link.
language=>HTML <p> If you are stuck, try <a href="http://www.google.com">googling</a> first. </p>
If you are stuck, try googling first.

You can use anchor links to enclose other elements, such as an image element <img>. So that when you click on the image, it will direct you to another page. We will look at the image element in later sections.
language=>HTML <a href="http://www.google.com"> <img /> </a>
This won't link to google, just adding the image here for illustration

This won't link to google, just adding the image here for illustration

When you are in the progress of website development and you aren't sure where your links will link to yet, you can turn it into a dead link that doesn't point anywhere by using a '#' sign.
language=>HTML <a href="#">Dead link</a>

Normally, anchor links open in the window tab you are currently browsing. We can make the anchor link open in a new window by adding the target attribute. Like so:
language=>HTML <a href="http://www.google.com" target="_blank">Google</a>
Exercise - Only do the following exercises

Trusted by

Students and instructors from world-class organizations

Join the upcoming Cohort #120

Enroll for December 7th, 2026