点击按钮平滑回到顶部
html:
<!--Scroll to top--> <div id="scroll-to-top" class="scroll-to-top"> <span class="icon ion-ios-arrow-up"></span> </div>
css:
.scroll-to-top { position: fixed; bottom: 30px; right: 30px; z-index: 999; height: 40px; width: 40px; background: #655E7A; border-radius: 50%; text-align: center; line-height: 40px; color: white; cursor: pointer; transition: 0.3s; display: none; }
@media (max-width: 480px) { .scroll-to-top { bottom: 15px; right: 15px; } }
鼠标悬浮按钮变色
.scroll-to-top:hover { background-color: #333; }