HTML XHTML Link Tutorial

How to link to another part of the same web page

The code below shows you how to link to another part of the same web page in HTML.

You can link to another part of the same web page by adding an id attribute to almost any HTML tag, for example <p id="gohere">this is where you end up</p>, and then link to it like this <a href="#gohere">you click here</a>. Clicking on the link will take you to the HTML element with that id.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title>Web Development Tutorials.com</title>
<style type="text/css">
</style>
</head>
<body>
<p>
<a href="#part15">Go to part 15 </a>
</p>
<p>
Part 1
Web Development Tutorials.com
</p>
<p>
Part 2
Web Development Tutorials.com
</p>
<p>
Part 3
Web Development Tutorials.com
</p>
<p>
Part 4
Web Development Tutorials.com
</p>
<p>
Part 5
Web Development Tutorials.com
</p>
<p>
Part 6
Web Development Tutorials.com
</p>
<p>
Part 7
Web Development Tutorials.com
</p>
<p>
Part 8
Web Development Tutorials.com
</p>
<p>
Part 9
Web Development Tutorials.com
</p>
<p>
Part 10
Web Development Tutorials.com
</p>
<p>
Part 11
Web Development Tutorials.com
</p>
<p>
Part 12
Web Development Tutorials.com
</p>
<p>
Part 13
Web Development Tutorials.com
</p>
<p>
Part 14
Web Development Tutorials.com
</p>
<p>
<a id="part15">Part 15 </a>
Web Development Tutorials.com
</p>
</body>
</html>

This link will take you a working example of linking within the same web page

Use the text editor below to practice what you have learned.

Host Unlimited Domains on 1 Account