Pure CSS Scroll Down Button

01/10/2021

Contents

Demo

Full Screen

Code

HTML

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Pure CSS Scroll Down Button</title>
    <link rel="stylesheet" type="text/css" href="https://demo.plantpot.works/assets/css/normalize.css">
    <link rel="stylesheet" href="https://use.typekit.net/opg3wle.css">
    <link rel="stylesheet" type="text/css" href="style.css">
  </head>
  <body>
    <div id="container">
      <a href="#"><span></span>Scroll</a>
      <h1>Pure CSS<br>Scroll Down Button</h1>
    </div>
  </body>
</html>

CSS

@charset "utf-8";
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
}
body {
  background-color: #0c2540;
  font-family: futura-pt, sans-serif;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}
#container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
  padding: 20px;
}
a {
  position: relative;
  padding-top: 60px;
  color: #fff;
  font-size: 1.125rem;
  letter-spacing: 2px;
  text-decoration: none;
}
a span {
  position: absolute;
  top: 0;
  right: calc(50% - 15px);
  bottom: 25px;
  left: calc(50% - 15px);
  width: 30px;
  border: 2px solid #fff;
  border-radius: 16px;
}
a span::before {
  opacity: 0;
  position: absolute;
  top: 8px;
  right: calc(50% - 3px);
  left: calc(50% - 3px);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #fff;
  content: '';
  animation: down 1.2s linear infinite;
}
h1 {
  margin: 20px 0 0;
  color: #38ff74;
  font-size: 3rem;
  letter-spacing: 1px;
  text-align: center;
}
@keyframes down {
  0% {
    opacity: 0;
    top: 8px;
  }
  5% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    top: 38px;
  }
}
@media screen and (max-width: 480px) {

  h1 {
    margin: 10px 0 0;
    font-size: 2rem;
  }
}