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

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?

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.

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

1 Like

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

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

1 Like

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

1 Like