From Coder Merlin
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

The <a> tag[edit]

In HTML, the <a> tag, or anchor element, allows you to create hyperlinks. Hyperlinks are what link one webpage to another using the href attribute. This feature can be used to link pictures, websites, emails, phone numbers, and other information on a website.

Let's look at an example of this.

Linking to another website[edit]

 <a href="https://www.examplewebsite.com">Website!</a> 

To understand how this line of code works, let's break it down into smaller components. The line begins with <a> and ends with </a>. The information for the hyperlink must be included within these two tags, and it is important to have both. If not, the code will not function as intended. Next, we include the href attribute followed by an "=" sign and quotation marks on both sides of the page URL we want to link to. To link the web page to text, follow the closing quotation with a ">" symbol and type in the text the user will see as a hyperlink. When they click it, it links to the other web page.

Linking an image[edit]

<a href="https://www.examplewebsite.com">
<img src="exampleimage.png">

Linking an image is similar to what we did before, but instead of hyperlinking text, we exchange it for an image. Include a new line of text with the <img> tag along with "src=", to indicate the source of the image. Insert the image source inside quotation marks, then close the line with a ">" symbol.

Congratulations, you've learned about the <a> tag! Try using this tag in your website to reference other pages in your own.