JSFiddle - React, Tailwind, and code Playground
by sberube
HTML
<div class="chart-container">
<div class="chart-bar"></div>
<div class="chart-bar"></div>
<div class="chart-bar"></div>
<div class="chart-bar"></div>
<div class="chart-bar"></div>
</div>
CSS
.chart-container {
width: 300px;
height: 200px;
border: 1px solid #999;
position: relative;
overflow: hidden;
}
.chart-bar {
width: 40px;
height: 0;
background-color: #888;
position: absolute;
bottom: 0;
transition: height 1s ease-in-out;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
@keyframes loadingAnimation {
0% {
height: 0;
}
25% {
height: 80%;
}
50% {
height: 50%;
}
75% {
height: 60%;
}
100% {
height: 100%;
}
}
.chart-bar:nth-child(1) {
left: 30px;
animation: loadingAnimation 2s infinite;
}
.chart-bar:nth-child(2) {
left: 80px;
animation: loadingAnimation 2s infinite;
animation-delay: 0.2s;
}
.chart-bar:nth-child(3) {
left: 130px;
animation: loadingAnimation 2s infinite;
animation-delay: 0.4s;
}
.chart-bar:nth-child(4) {
left: 180px;
animation: loadingAnimation 2s infinite;
animation-delay: 0.6s;
}
.chart-bar:nth-child(5) {
left: 230px;
animation: loadingAnimation 2s infinite;
animation-delay: 0.8s;
}