Skip to main content

Command Palette

Search for a command to run...

HTML Tutorial For Beginners Part 4

In this article you learn how to link your section internally

Updated
1 min read
HTML Tutorial For Beginners Part 4
A

I am a web developer from Afghanistan and I am ready for remote working and mentoring and as well for accepting internship.

a (anchor) elements can also be used to create internal links to jump to different sections within a webpage.

To create an internal link, you assign a link's href attribute to a hash symbol # plus the value of the id attribute for the element that you want to internally link to, usually further down the page. You then need to add the same id attribute to the element you are linking to. An id is an attribute that uniquely describes an element.

Below is an example of an internal anchor link and its target element:

<a href="#contacts-header">Contacts</a>
...
<h2 id="contacts-header">Contacts</h2>

When users click the Contacts link, they'll be taken to the section of the webpage with the Contacts header element.

Demo

https://codepen.io/ahmadullah1919/pen/QWvOmVE

HTML TUTORIAL FOR BEGINNERS

Part 4 of 11

In this series, I will teach or post useful lessons about HTML and it's tips and tricks

Up next

Html Tutorial For Beginners Part 5

In this story you're going to learn how nest HTML elements within each other🤯