Home > DeveloperSection > Articles > Stylish CSS3 progress bars

Stylish CSS3 progress bars


CSS-CSS3 HTML5 Canvas  CSS  CSS Selector 
Ratings:
0 Comment(s)
 2823  View(s)
Rate this:

Stylish CSS3 progress bars

Hi friends In this article I’m explaining about CSS3 features stylish progress bars using css3.

Description:

You've seen progress bars everywhere, they are those bars that display the current completion state for a process, such as a download or file transfer. Whether you're building a desktop or a web application, at a certain point, you may need to use this UI element.

Having said that, in this article you'll learn how to create stylish and animated progress bars using CSS3.

HTML

<div class="progress-bar blue stripes">

    <span style="width: 40%"></span>

</div>

CSS

.progress-bar {

    background-color: #1a1a1a;

    height: 25px;

    padding: 5px;

    width: 350px;

    margin: 50px 0;        

    border-radius: 5px;

    box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444;          

}

 

.progress-bar span {

    display: inline-block;

    height: 100%;

    border-radius: 3px;

    box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset;

    transition: width .4s ease-in-out;   

    background-color:#a5a5a5;

}

Output

Let's add some color, gradients, stripes:

You may have seen this CSS3 technique before, I just adapted it a little for this example:

 

.progress-bar {

    background-color: #1a1a1a;

    height: 25px;

    padding: 5px;

    width: 350px;

    margin: 50px 0;        

    border-radius: 5px;

    box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444;          

}

 

.progress-bar span {

    display: inline-block;

    height: 100%;

    border-radius: 3px;

    box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset;

    transition: width .4s ease-in-out;   

    background-color:#a5a5a5;

}

 

.blue span {

    background-color: #34c2e3;  

}

 

.orange span {

      background-color: #fecf23;

      background-image: linear-gradient(top, #fecf23, #fd9215); 

}  

 

.green span {

      background-color: #a5df41;

      background-image: linear-gradient(top, #a5df41, #4ca916); 

}

 

.stripes span {

    background-size: 30px 30px;

    background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%,

                        transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,

                        transparent 75%, transparent);           

   

    animation: animate-stripes 3s linear infinite;            

}

 

@keyframes animate-stripes {

    0% {background-position: 0 0;} 100% {background-position: 60px 0;}

}

 

Output

Shine

Not sure if this is the best name I could find for this CSS3 animation, but here we go:

HTML

<div class="progress-bar blue stripes">

    <span style="width: 40%"></span>

</div>

<div class="progress-bar orange shine">

    <span style="width: 100%"></span>

</div>

<div class="progress-bar green stripes">

    <span style="width: 50%"></span>

</div>

 

CSS

.progress-bar {

    background-color: #1a1a1a;

    height: 25px;

    padding: 5px;

    width: 350px;

    margin: 50px 0;        

    border-radius: 5px;

    box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444;          

}

 

.progress-bar span {

    display: inline-block;

    height: 100%;

    border-radius: 3px;

    box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset;

    transition: width .4s ease-in-out;   

    background-color:#a5a5a5;

}

 

.blue span {

    background-color: #34c2e3;  

}

 

.orange span {

      background-color: #fecf23;

      background-image: linear-gradient(top, #fecf23, #fd9215); 

}  

 

.green span {

      background-color: #a5df41;

      background-image: linear-gradient(top, #a5df41, #4ca916); 

}

 

.stripes span {

    background-size: 30px 30px;

    background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%,

                        transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,

                        transparent 75%, transparent);           

   

    animation: animate-stripes 3s linear infinite;            

}

 

@keyframes animate-stripes {

    0% {background-position: 0 0;} 100% {background-position: 60px 0;}

}

 

.shine span {

    position: relative;

}

 

.shine span::after {

    content: '';

    opacity: 0;

    position: absolute;

    top: 0;

    right: 0;

    bottom: 0;

    left: 0;

    background: #fff;

    border-radius: 3px;

    animation: animate-shine 2s ease-out infinite;            

}

 

@keyframes animate-shine {

    0% {opacity: 0; width: 0;}

    50% {opacity: .5;}

    100% {opacity: 0; width: 95%;}

}

 

Output

Glow

CSS3 keyframes animation based on box-shadow property:

.glow span {

    box-shadow: 0 5px 5px rgba(255, 255, 255, .7) inset, 0 -5px 5px rgba(255, 255, 255, .7) inset;   

    animation: animate-glow 1s ease-out infinite;         

}

 

@keyframes animate-glow {

 0% { box-shadow: 0 5px 5px rgba(255, 255, 255, .7) inset, 0 -5px 5px rgba(255, 255, 255, .7) inset;}

 50% { box-shadow: 0 5px 5px rgba(255, 255, 255, .3) inset, 0 -5px 5px rgba(255, 255, 255, .3) inset;}

 100% { box-shadow: 0 5px 5px rgba(255, 255, 255, .7) inset, 0 -5px 5px rgba(255, 255, 255, .7) inset;}

 }

 

Output


in my next post i'll discuss about Offline Add, Edit, Delete Data in HTML5 IndexedDB


Don't want to miss updates? Please click the below button!

Follow MindStick