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.
Set the position of div at the bottom of its container can be done using bottom, and position property. Set position value to absolute and bottom value to zero to placed a div at the bottom of container.
An <a> tag can also be used to mark a section of a web page as a target for another link to jump to. For example, this link will jump to the bottom of this page. If the "name" and "id" attribute is used, the <a> tag is an anchor, but if the "href" attribute is used then it is a link.
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);
<a href="javascript: document.body.scrollIntoView(false);">Scroll to bottom</a>
<a href="#" id="scroll-to-bottom">Scroll to bottom</a>
document.getElementById("scroll-to-bottom").addEventListener("click", function () {
document.body.scrollIntoView(false);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With