Skip to content

This is one of our old lessons! Visit the Path page to see all of our latest courses.

Link to another page on your website – HTML

Summary

To create a link to another page on your website, use the anchor element with the href attribute.

<a href="page.html">Link text</a>

Details

Examples

If the file you’re linking to is in the same folder as your current HTML file, just use the file name with the href attribute. Here’s an example:

<a href="about.html">Link to about page</a>

If the file you’re linking to is in a subfolder, make sure you include the folder name in the href attribute. Here’s an example:

<a href="folder/about.html">Link to About page in different folder</a>

If the file you’re linking to is in a higher folder, use two dots to move up a folder. Here’s an example:

<a href="../index.html">Link back to home page</a>

References

The Anchor element on MDN