One can use the anchor tag to redirect to a particular section on the same page. You need to add "id attribute" to the section that you want to show and use the same id in href attribute with "#" in the anchor tag. So that On click a particular link, you will be redirected to the section that has the same id mentioned in the anchor tag.
Syntax
home
Example
Welcome to GeeksforGeeks
This is the example of
Redirect to a particular section
using HTML on same page
Contact Us
Home section
About Us section
Contact Us section
Team Section
- It is an HTML page with headings, paragraphs, and sections inside
elements.
- Each section (
) is given a fixed height (400px) and a border for separation.
- Clicking the "Contact Us" link jumps to the "Contact Us" section using id="contactUs".
- The page has four sections – Home, About Us, Contact Us, and Team, displayed in separate
blocks.