JSFiddle - React, Tailwind, and code Playground
by Luca Detomi
HTML
<div class="progressbar" style="width:75%"></div>
CSS
*,:before,:after {box-sizing:border-box;}
.progressbar {
height: 15px;
border-radius: 1em;
overflow: hidden;
position:relative;
transition:width 1s ease-in-out;
}
.progressbar:before,
.progressbar:after {
content:"";
display:block;
height: 100%;
position:absolute;
top:0;
left:0;
}
.progressbar:before {
width: 100vw;
background: linear-gradient(to right, red 0%, yellow 50%, green 100%);
box-shadow:inset 0px -2px 5px rgba(0, 0, 0, 0.5);
}
.progressbar:not([style]):before,
.progressbar[style='']:before{
background: lightgray;
}
.progressbar:after {
z-index:1;
width: 100%;
border-radius: 1em;
animation: progress 1s linear infinite;
background-repeat: repeat-x;
background-size: 30px 30px;
background-image: linear-gradient(-45deg,
rgba(255, 255, 255, 0.15) 25%,
transparent 25%,
transparent 50%,
rgba(255, 255, 255, 0.15) 50%,
rgba(255, 255, 255, 0.15) 75%,
transparent 75%, transparent);
}
@keyframes progress
{
to {background-position: 30px 0;}
}