How to Create Animated Loader Ring using HTML and CSS?

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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>

chevron_right


Output:

full-stack-img




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.