How to create a preloader with CSS?

CSSWeb DevelopmentFront End Technology

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


 Live Demo

<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1" />
      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);
<h1>Creating a pre Loader example</h1>
<div class="loader"></div>


The above code will produce the following output −

Updated on 07-May-2020 11:38:58