Creating a link to a specific part of a web page.

justintime

Free Member
Apr 12, 2009
635
94
Ripon
Hi, I wondered if someone could help me. I have used an online website template and amended it to suit. It's one of those scrolling ones and in the menu you can click on a heading and it scrolls down to the relevant section. There is also a dropdown heading to add additional pages.

When you click on an additional page, then click on (say) About Us, it simply adds #about to the html page you're on. I have tried <a href="index.html#about"> but that doesn't work. Any suggestions please?
 
D

Deleted member 325090

This may not be your issue, but it's worth checking for starters.

The "#about" bit needs to marry up precisely with the html id of the bit of the page which it needs to scroll to.

So check that your page has a html element which has an id of "about" (without the hash). If it doesn't add it in and see if it works.

You can also check this by opening the developer tools window (F12), and typing:

document.getElementById('about')

in the console. If it returns null then that's your problem
 
Upvote 0

Latest Articles