How to create a preloader with CSS?

CSSWeb DevelopmentFront End Technology

To create a preloader with CSS, the code is as follows −

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
   body{
      font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
   }
   .loader {
      border: 16px double #ffee00;
      border-radius: 50%;
      border-top: 16px solid #7434db;
      width: 140px;
      height: 140px;
      -webkit-animation: loader 2s linear infinite; /* Safari */
      animation: loader 2s linear infinite;
   }
   @-webkit-keyframes loader {
      0% {
         -webkit-transform: rotate(0deg);
      }
      100% {
         -webkit-transform: rotate(360deg);
      }
   }
   @keyframes loader {
      0% {
         transform: rotate(0deg);
      }
      100% {
         transform: rotate(360deg);
      }
   }
</style>
</head>
<body>
<h1>Creating a pre Loader example</h1>
<div class="loader"></div>
</body>
</html>

Output

The above code will produce the following output −

raja
Published on 07-May-2020 11:35:46
Advertisements