Linking Pages

What We'll Be Building

When using websites, we rarely ever stay on one page the entire time, we move around from one webpage to another whilst on the same website. This is accomplished by linking our pages together. To link pages together we're going to use something called an anchor tag.

Anchor tags look like this: <a href="page-to-link">

Anchor tags are similar to image tags which we looked at a little earlier, in that they have an attribute that takes a URL. For the image tag it was the src attribute, and now for the anchor tag, it's the href attribute, which tells the link where to take you after you've clicked it.

links.html
<!DOCTYPE html>
<html>
    <body>
        <a href="https://www.Google.com"> This Link's to Google </a>
    </body>
</html>

Exercises

  1. Create one new HTML page called links.html and another called secret.html.

  2. On links.html add an anchor tag that links to secret.html. For example, on links.html I can create and anchor tag that looks like this: <a href="secret.html"> Lists Page </a> which will link a user to my secret.html.

Last updated

Was this helpful?