Dark CSS

CSS Skeleton Loading Animation

Facebook
Twitter
WhatsApp

Project preview

html code

				
					<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Shimmer Loading Effect</title>
    <link rel="stylesheet" href="style.css">
</head>
 
<body>
    <div class="wrapper">
        <div class="box">
            <div class="circle shimmer"></div>
            <div class="rectangle shimmer"></div>
        </div>
    </div>
</body>

</html>
				
			

css code

				
					* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

html,
body { 
    display: grid;
    height: 100%;
    place-items: center;
    background: #e8e8e8;
}

.wrapper {
    width: 300px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.11);
    padding: 10px;
}

.box {
    display: flex;
    align-items: center;
}

.shimmer {
    background: linear-gradient(100deg,
            #ededed 30%,
            #dcdcdc 50%,
            #ededed 70%);
    background-size: 400%;
    animation: shimmer 1.5s infinite linear;
}

.circle {
    border-radius: 50%;
    width: 50px;
    height: 50px;
    margin-right: 10px;
}

.rectangle {
    width: 170px;
    height: 50px;
    border-radius: 10px;
}

@keyframes shimmer {
    from {
        background-position: 100% 100%;
    }

    to {
        background-position: 0 0;
    }
}