In this tutorial we will see how to create Pure CSS Animated Progress Bar. Complete CSS Code and HTML Code is given.
Table of Contents
HTML Code
HTML Code is given below.
<div class="main-bar">
<div class="percentage" data-per='80%'></div>
</div>
CSS Code
CSS Code is given below.
body
{
margin: 0;
padding: 0;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background-color: #B1A0EB;
font-family: 'Barlow Condensed' ,sans-serif;
}
.main-bar
{
position: relative;
width: 500px;
height: 35px;
background-color: #2b2b2b;
border-radius: 3px;
box-shadow: 0px 0px 2px 0px #000;
cursor: pointer;
}
.percentage
{
width: 0%;
height: 35px;
border-radius: 3px;
background: repeating-linear-gradient(45deg, #C41010, #C41010 17px, #eee 10px, #eee 20px);
animation: width 4s;
animation-fill-mode: forwards;
}
.percentage::before
{
position: absolute;
content: attr(data-per);
width: 90px;
padding: 15px 0px;
background-color: #fff;
color: #555;
text-align: center;
font-size: 20px;
font-weight: bold;
border-radius: 5px;
left: 50%;
bottom: 75px;
transform: translate(-50%);
box-shadow: 0px 0px 2px 0px #333;
}
.percentage::after
{
position: absolute;
content: '';
width: 14px;
height: 14px;
background-color: #fff;
border-radius: 3px;
left: 50%;
bottom: 67px;
transform: translate(-50%) rotate(45deg);
border-bottom: 1px solid #777;
border-right: 1px solid #777;
border-top: 1px solid #fff;
border-left: 1px solid #fff;
}
@keyframes width
{
from
{
width: 0%;
}
to
{
width: 80%;
}
}
Demo
Video Tutorial
Watch our video tutorial on Pure CSS Animated Progress Bar.