JSFiddle - React, Tailwind, and code Playground

by Anav02

HTML

<!DOCTYPE html>
<html>
<head>
    <title>Fancy CSS Loader</title>
</head>
<body>
<section>
        <div></div>
    </section>
</body>
</html>

CSS

* {
    padding: 0;
    margin: 0;
    outline: none;
}
:root {
    --main:#1d1e22;
    --accent:#38B6FF;
}

body {
  background-color: #282A30;
}

section {
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    position: relative;
    justify-content: center;
    align-items: center;
}
 div {
    position: absolute;
    content: '';
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    height: 50px;
    border-radius: 50%;
    width: 50px;
    animation:  spin 1.7s ease infinite;
    transform-origin: top left;
}

 div::before {
    content: "";
    position: absolute;
    height: 10px;
    width: 10px;
    background-color: var(--accent);
    border-radius: 50%;
    top: 0;
    right: 50%;
    transform: translateX(50%);
    box-shadow: 0px 0px 20px 5px var(--accent);
    border: 2px solid white;
}

 div::after {
    content: "";
    position: absolute;
    height: 10px;
    width: 10px;
    background-color: var(--accent);
    border-radius: 50%;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0px 0px 20px 5px var(--accent);
    border: 2px solid white;
}

@keyframes spin {
    0% {
        rotate: 0deg;
    }
    50% {
        rotate: 720deg;
    }

    100% {
        rotate: 0deg;
    }
}