Open In App

How to Create Animated Loader Ring using HTML and CSS?

Last Updated : 11 May, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

The Loader Ring can be easily generated using HTML and CSS. The Loader Ring displays when the browsers are loading web pages. To create a loader ring, we will make the use of CSS animations that allows animation of HTML elements.

HTML Code is used to create a basic structure of the animated loader ring and CSS code is used to set the style of Loader Ring. We will use the @keyframes rule that allows the animation to gradually change from current style to the new style at certain times then we will use the transform property to rotate the animation 360 degrees.

Example:




<!DOCTYPE html>
<html>
  
<head>
    <meta charset="utf-8">
    <title>
        How to Create Animated Loader
        Ring using HTML and CSS?
    </title>
  
    <style>
        body {
            margin: 0;
            padding: 0;
            background: #008000;
        }
  
        .circle {
            position: absolute;
            top: 40%;
            left: 50%;
            transform: translate(-40%, -50%);
            animation: effect 1s linear infinite;
            width: 100px;
            height: 100px;
            border-radius: 50%;
            border: 6px solid rgba(255, 255, 255, 0.3);
            border-top-color: #fff;
        }
  
        @keyframes effect {
            0% {
                transform: rotate(0deg);
            }
  
            100% {
                transform: rotate(360deg);
            }
  
        }
    </style>
</head>
  
<body>
    <div class="circle"></div>
</body>
  
</html>


Output:



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads