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.0k times
4 Answers
14
There isn't one.
You can simulate it, though, with something like <a id="bottom"></a>, then linking to #bottom.
You might find this post helpful, as well.
-
Glad to help. Please remember to accept an answer. :) – elixenide Jul 19 '14 at 04:47
-
After 6 min, I will :) – OJuice Jul 19 '14 at 04:50
10
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
- 13,784
- 4
- 44
- 72
-
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>