Website loader Animation using HTML and CSS

Sliding loader using HTML and CSS animation. Intuitive preloaded for loading website animation.

CSS Properties

Following are the CSS properties used:

  1. Border-radius: The border-radius CSS property rounds the corners of an element’s outer border edge. You can set a single radius to make circular corners, or two radii to make elliptical corners.
  2. Width: The width CSS property sets an element’s width. By default, it sets the width of the content area, but if box-sizing is set to border-box, it sets the width of the border area.
  3. Height: The height CSS property specifies the height of an element. By default, the property defines the height of the content area. If box-sizing is set to border-box, however, it instead determines the height of the border area.
  4. Margin: The margin CSS shorthand property sets the margin area on all four sides of an element.
  5. Background: The background shorthand CSS property sets all background style properties at once, such as color, image, origin and size, or repeat method.

Website loader Code Block

Here is the code for implementing the Preloader 2 Animation.

.loader {
        margin: 40px;
        width: 200px;
        height: 20px;
        border-radius: 20px;
        background: linear-gradient(orange 0 0) 0/0% no-repeat lightblue;
        
      }

Yay! We have created the static Preloader 2 Animation.

Here is the output:

Preloder 2 html css

Website loader CSS Animation

load animation can be implemented by scaling up and down the shape linearly.

Following are the classes used for animation.

The @keyframes CSS at-rule controls the intermediate steps in a CSS animation sequence by defining styles for keyframes (or waypoints) along the animation sequence. This gives more control over the intermediate steps of the animation sequence than transitions.

The transform CSS property lets you rotate, scale, skew, or translate an element. It modifies the coordinate space of the CSS visual formatting model.

Here is the CSS animation class implementing CSS.

@keyframes  load {
        100% {
          background-size: 110%;
        }
      }

The following way is to declare the CSS Class inside the class block.

 .loader {
        margin: 40px;
        width: 200px;
        height: 20px;
        border-radius: 20px;
        background: linear-gradient(orange 0 0) 0/0% no-repeat lightblue;
        animation: load 2s infinite steps(10);
      }
      @keyframes load {
        100% {
          background-size: 110%;
        }
      }

Following is the output for Preloader 2 Animation animation.

Website loader 2 animation css html

Website loader Video Tutorial

You can find the complete coding tutorial in the following YouTube Short video.

Complete Code using HTML and CSS

Copy and paste the complete code in Visual studio code to view the output.


<!DOCTYPE html>
<html lang="en">
  <head>
    <style>
      .loader {
        margin: 40px;
        width: 200px;
        height: 20px;
        border-radius: 20px;
        background: linear-gradient(orange 0 0) 0/0% no-repeat lightblue;
        animation: load 2s infinite steps(10);
      }
      @keyframes load {
        100% {
          background-size: 110%;
        }
      }
    </style>
    <title>Salow Studios</title>
  </head>
  <body>
    <h1>Loader Animation</h1>
    <div class="loader"></div>
  </body>
</html>

Thank you for reading this article. I hope that it helps you creating your own Preloader 2 Animation Animation using CSS and HTML. See you in next tutorial!