Skip to main content

Command Palette

Search for a command to run...

How to create links to sections within an Html page

Updated
โ€ข1 min read
How to create links to sections within an Html page

An anchor tag is used to create a hyperlink that allows users to flow through sections of a page and can also be used to transfer the users to a different webpage.

Syntax:

<a href="link"></a>

To create an anchor link, an id attribute is added to an element to name it. More than one element on a webpage should not have the same id name. When naming an id, instead of using spaces to separate words an underscore would be more appropriate.

<div id="element_name"></div>

After naming each element, create a hyperlink with the use of an anchor element and then input the target the id name (preceded by a #)

<a href="#element_name"></div>

carbon (4).png

F

Woah! Welldone Titilope ๐Ÿ‘๐Ÿ‘๐Ÿ‘