How to make back to top button (EASIEST WAY)

Note: make sure you have imported awesome font


Put this in your HTML
<a href="#" id="scroll-to-top"><i class="fa fa-angle-up"></i></a>


Put these in your HTML

html {
  scroll-behavior: smooth;
}
#scroll-to-top{
position:fixed;
bottom:5%;
  padding:20px;
background:var(--primary-color);
content:"Top";
color:white;
right:20px;
box-shadow: 0 6px 10px 0 rgba(0, 0, 0, 0.3);
border-radius:50%;
height:50px;
width:50px;
-webkit-transition: 0.2s;
  transition: 0.2s;
}

#scroll-to-top i{
top:-5px;
position:relative;

}
#scroll-to-top:active {
  -webkit-transform: scale(0.9);
          transform: scale(0.9);
  box-shadow: 0 2px 15px 0 rgba(0, 0, 0, 0.3);
}


Comments

Popular posts from this blog

Workplace Task: 10 – Understanding Risk - Innovation

“How-to” blog post + create infographic through Canva