JSFiddle - React, Tailwind, and code Playground

by luka kupunia

HTML

<div class="Preloader__loader">
    <div></div>
    <div></div>
</div>

CSS

.Preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #030a14;
    z-index: 2000;
    transition: opacity 0.3s;
}

.Preloader--hidden {
    opacity: 0;
}

.Preloader__wrapper {
    position: absolute;
    top: calc(50% - 32px);
    left: calc(50% - 32px);
}

.Preloader__loader {
    display: inline-block;
    position: relative;
    width: 64px;
    height: 64px;
}

.Preloader__loader div {
    position: absolute;
    border: 4px solid #fff;
    opacity: 1;
    border-radius: 50%;
    animation: preloader 1s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

.Preloader__loader div:nth-child(2) {
    animation-delay: -0.5s;
}

.Preloader__loader div:nth-child(3) {
    animation-delay: -1.2s;
}

@keyframes preloader {
    0% {
        top: 50%;
        left: 50%;
        width: 100%;
        height: 100%;
        transform: translate3d(-50%, -50%, 0) scale(0);
        opacity: 1;
    }

    100% {
        top: 50%;
        left: 50%;
        transform: translate3d(-50%, -50%, 0) scale(1);
        width: 100%;
        height: 100%;
        opacity: 0;
    }
}

body {
    background: black;
    margin: 100px;
}