Advertisement
colin123

Back to Top Button HTML

Dec 11th, 2019
660
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. [CODE1]
  2.  
  3. #myBtn {
  4. position: fixed; /* Fixed/sticky position */
  5. bottom: 20px; /* Place the button at the bottom of the page */
  6. right: 30px; /* Place the button 30px from the right */
  7. z-index: 99; /* Make sure it does not overlap */
  8. border: none; /* Remove borders */
  9. outline: none; /* Remove outline */
  10. background-color: red; /* Set a background color */
  11. color: white; /* Text color */
  12. cursor: pointer; /* Add a mouse pointer on hover */
  13. padding: 15px; /* Some padding */
  14. border-radius: 10px; /* Rounded corners */
  15. font-size: 18px; /* Increase font size */
  16. }
  17.  
  18. #myBtn:hover {
  19. background-color: #555; /* Add a dark-grey background on hover */
  20. }
  21.  
  22. [CODE2]
  23.  
  24. <a name="top"></a>
  25.  
  26. [CODE3]
  27.  
  28. <button onclick="window.location.href = '#top';" id="myBtn" title="Go to top">Back to Top</button>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement