How to code navigation bar to go to certain part of webpage

How to code navigation bar to go to certain part of webpage
0.0 0

#1

I have set up my nav bar using ul in html and styling it in css. It looks like I did it correctly, but how do I code this so that when I click on “About” in the nav bar, it goes to my About section of the page?


#2

You can give the About section an id, and then put that id in the href of your a tag. Because an id has to be unique in the document, the href knows which section it should refer to.


#3

https://www.computerhope.com/issues/ch000049.htm


#4

I tried this just now and when I clicked on About, it took me to a page with an error.


#5

Did you put the # in front of the id? (just like you would do in css)


#6

Just kidding, it worked. Forgot the # when I put the id in the href.