HTML
CSS
JavaScript
jQuery
PHP
SQL
WordPress
HTML Tutorials

Overview

An HTML anchor link is a typical hyperlink except that it’s used to either jump to another section on the same page or specific section of another page.

First the “bookmarked” area is created by placing an id attribute in a page element you want to link to.

				
					<h2 id="chapter_6">Chapter 6</h2>
				
			

Then, elsewhere on the page, you create a link to that bookmark. This link could appear in several locations on the page if necessary to allow the user quick access to the bookmarked area.

What makes it an anchor link is that the href attribute does not contain a URL to another page, but simply the id of the element you want to link to.

				
					<a href="#chapter_6">Go to Chapter 6</a>
				
			

An anchor link can also be used to link to a specific section of another page. A typical link will load the new page at the top. However, If you create a bookmarked area somewhere on that new page, you can then link directly to it from a different page by adding the id just after the URL of the target page.

				
					<a href="/pages/my-book.html#chapter_6">Go to Chapter 6</a>
				
			

We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.

HTML
CSS
JavaScript
jQuery
PHP
SQL
WordPress

Why 1SMARTchicken?

This site was built and is maintained to benefit my autistic son.
See More →

My Son's Name is Johnny

He was diagnosed as autistic quite late, at age four...
His story

Buy Me a Coffee

Thanks for your support!

Feedback

If you see an error on the page or the code itself is incorrect or incomplete, or just plain wrong, please let us know. We’re always learning. NOTE: we do not sell your information and will not send you spam emails.