-2

I have a site and there are multiple sections on the homepage

What I'm trying to do is add an anchor to the navigation. So, when I'm on my home page and click the "About Us" nav link, it will scroll down to the about section on that home page. Also, when I go to my next page (Contact Page, Not Homepage), I can click on the "About us" navigation link, and it would take me to that section on the home page, and not the top of the home page.

Is there a way in HTML to do this?

Henry
  • 1
  • 1
  • 1
    Does this answer your question? [How do I modify the URL without reloading the page?](https://stackoverflow.com/questions/824349/how-do-i-modify-the-url-without-reloading-the-page) – Wais Kamal Sep 07 '20 at 14:20
  • I don't think so. I want to create a navigation link that connects to a section on a page. For example, when I click on About Us in the nav, it goes to the about us section on the home page and not the top of the home page. – Henry Sep 07 '20 at 14:48

2 Answers2

0

You can by using anchor - like you said in your title.

If you're interest in smooth scrolling use scroll-behaviour.

SeeoX
  • 384
  • 12
0

You can use an ID inside a href link to send users to a specific element corresponding to that ID. For example:

<a href="#about">Link to my About section</a>

<div id="section-hello"> Text here </div> 
<div id="section-portfolio"> Portfolio here </div> 
<div id="about"> Here is my about section where I want an anchor. </div>

The menu link inside your menu should be: www.testsite.com/#about. This will direct the user to the specific about section on your homepage. Unfortunately it's not possible to generate an /about permalink through html inside another page.