什么是通用的HTML锚点标签用于跳转到页面底部?我知道标签'#'会自动将用户带到页面顶部,但不确定标签如何实现跳转到页面底部。
答案:使用HTML锚点标签""和属性"href='#bottom'"可以跳转到页面底部。
什么是通用的HTML锚点标签用于跳转到页面底部?我知道标签'#'会自动将用户带到页面顶部,但不确定标签如何实现跳转到页面底部。
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);
});
<a href="#end">
”来创建链接。标签 #footer
然后
像这样id页脚...
<a href="#footer">Go to bottom</a>
<footer id="footer"></footer>
像这样...
<a href="#">Go to top</a>