Log in

View Full Version : Links for each section of a page



Terrym
01-30-2014, 11:10 PM
I used to develop websites a lot of years ago, and have since returned. But obviously everything has changed
( I started with HTML 3 then on to 4 and messed with JS ) I'm doing ok, but one thing escapes me. I have seen
sites, W3C being one of them, where if you click on a link on the nav'bar it will take you to another section of the
same page. If somebody could point me in the direction of how to do that I would be most grateful. In the early
years you created a frameset, then had to build pages to drop into your main page using a link. That's OK if it's
a big site (although that format is not used now so I believe). As the site I'm working on isn't very big and each
section only holds a cross section of items, one page would suffice. Any ideas?

terrym

jscheuer1
01-31-2014, 12:00 AM
What you are talking about used to be called a named anchor because it used the name attribute of an a tag to navigate to that section of the page. However, the current convention is to use the id attribute for the same purpose. See:

http://www.w3schools.com/html/html_links.asp

Scroll down to the section titled "HTML Links - The id Attribute".

Also see the interactive demo:

http://www.w3schools.com/html/tryit.asp?filename=tryhtml_link_locations

If you have more questions about it, just ask.