chrisjchrisj — 2013-11-04T12:33:50-05:00 — #1
How can I link from web page A to a specific place on web page B?
stevie_d — 2013-11-04T13:15:04-05:00 — #2
On web page B, give the element that you want to jump to an ID, eg <p id="somethingrandom">
(You can achieve the same effect by adding <a name="somethingrandom"></a>, but that is very old-fashioned and not recommended)
Then, on web page A, you add that onto the link with a hash, eg <a href="pageb.htm#somethingrandom">
chrisjchrisj — 2013-11-04T14:31:34-05:00 — #3
Thanks for that help. It worked successfully.
Then I tried another link, from lower in the page to the top of that same page, using this code (without success):
<a href="#top">Learn More</a>
When I select the Learn More, I am directed to the home page.
Any additional help will be appreciated.
stevie_d — 2013-11-04T18:14:33-05:00 — #4
From what you've told us, that shouldn't happen. Your code looks exactly right, apart from being 10+ years out of date, so either your code doesn't say exactly what you've written here or there's something funny going on. Double check that you're looking at the right version of the page and clicking on the right link, and if it's still giving unexpected behaviour then post a link to the problem page here and we'll have a look at it.
Edit: just a thought, you haven't got a <base> element on the page or anything like that, have you?
ralphm — 2013-11-04T18:30:51-05:00 — #5
Yes, you should use the same code as you used in the previous scenario. If you just want to link to the top of the page, choose an element at the top of the page and add an ID to it, such as
<header <font color='"#FF0000"'>id="top"</font>>
francky — 2013-11-06T20:43:28-05:00 — #6
Sometimes the top element (or the body) has some fee space under the top of the page.
In that case, you can set the id="top" on the <html> tag, and you will go just to the border of the viewport, whatever margins or paddings are used.
davep1234 — 2013-11-14T09:00:25-05:00 — #7
Should work, got mine set like this. If you can't even click on link, make sure no borders of any blocks are overlapping the link(Had that happen to me, absolute position block element border was larger then the containing content and was invisible to the eye without the border: CSS style added.
<header id=top> .... </header>
<a href = "#top"> Link to top of page </a>
system — 2014-10-08T01:10:20-04:00 — #8
This topic is now closed. New replies are no longer allowed.