Single element loader

In this example below you will see how to do a Single element loader with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by KeizerDev, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright KeizerDev ©
  • HTML
  • CSS
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>Single element loader</title>
  
  
  
      <style>
      /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */
      .loader {
  width: 10em;
  margin: 0 auto;
  height: 1em;
  border: 3px solid #2c3e50;
  border-radius: .2em;
  padding: 2px 2px 2px 2px;
}
.loader::after {
  border-radius: .15em;
  content: '';
  width: 10em;
  background-color: #2c3e50;
  display: block;
  height: 1em;
  animation: load 5s;
}
@keyframes load {
  from {
    width: 0em;
  }
  to {
    width: 10em;
  }
}

    </style>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>

</head>

<body>

  <div class="loader"></div>
  
  

</body>

</html>

/*Downloaded from https://www.codeseek.co/KeizerDev/single-element-loader-aAxGb */
.loader {
  width: 10em;
  margin: 0 auto;
  height: 1em;
  border: 3px solid #2c3e50;
  border-radius: .2em;
  padding: 2px 2px 2px 2px;
}
.loader::after {
  border-radius: .15em;
  content: '';
  width: 10em;
  background-color: #2c3e50;
  display: block;
  height: 1em;
  animation: load 5s;
}
@keyframes load {
  from {
    width: 0em;
  }
  to {
    width: 10em;
  }
}

Comments