What is the universal HTML anchor tag to go to the 'bottom' of the page? I know the tag '#' automatically brings the user to the top of the page but I am not so sure about the bottom of the page though.
Asked
Active
Viewed 6.8k times
4 Answers
12
In my opinion, it's better to implement this in JavaScript and definitely jump to the bottom of the page, instead of relying that the CSS styling on a link makes it always appear at the bottom of the page.
This JavaScript snippet will scroll to the bottom of the document:
document.body.scrollIntoView(false);
Inline JavaScript solution
<a href="javascript: document.body.scrollIntoView(false);">Scroll to bottom</a>
Separate JavaScript solution
HTML
<a href="#" id="scroll-to-bottom">Scroll to bottom</a>
JavaScript
document.getElementById("scroll-to-bottom").addEventListener("click", function () {
document.body.scrollIntoView(false);
});

Nick McCurdy
- 17,658
- 5
- 50
- 82
-
1That could work, but I wasn't looking for anything fancy. But this is a great answer, I'll keep this in mind, thanks :) – OJuice Jul 19 '14 at 04:55
-
1
tag #footer
and then
id the footer like so...
<a href="#footer">Go to bottom</a>
<footer id="footer"></footer>
in contrast you can tag to top of page without anchor using the # symbol only. You can use #top as well
Like so...
<a href="#">Go to top</a>