Linking to a section within a new HTML page

863 views html

I am creating a navigation bar for a website and I would like the button to link to the contact section on my homepage (index.html). Currently if you are on the page that has my portfolio and want to go to this section it just goes to the top of my homepage rather than the contact section which is about halfway down the page (has the alt id "#contact."

I currently have this code in my navbar class:

<a href="index.html" onclick="w3_close()" class = "bar-item button center">CONTACT</a>

Any suggestions on how I can make it go directly to this section from another page?

answered question

1 Answer


Do this:

<a href="index.html#contact" onclick="w3_close()" class = "bar-item button center">CONTACT</a>

posted this

Have an answer?


Please login first before posting an answer.