html
<div>
<button onclick="returnTop()" id="btnTop" title="返回顶部">返回顶部</button>
<button onclick="returnBottom()" id="btnBottom" title="去到底部">去到底部</button>
</div>
样式
#btnTop {
display: none;
position: fixed;
bottom: 20px;
right: 30px;
z-index: 99;
border: none;
outline: none;
background-color: #89cff0;
color: white;
cursor: pointer;
padding: 15px;
border-radius: 10px;
}
#btnTop:hover {
background-color: #1E90FF;
}
#btnBottom {
display: none;
position: fixed;
bottom: 100px;
right: 30px;
z-index: 99;
border: none;
outline: none;
background-color: #89cff0;
color: white;
cursor: pointer;
padding: 15px;