articles

Home / DeveloperSection / Articles / Stylish CSS3 progress bars

Stylish CSS3 progress bars

Anonymous User8740 17-Nov-2014

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
<divclass="progress-bar blue stripes">
    <spanstyle="width: 40%"></span>
</div>

CSS

.progress-bar {
    background-color: #1a1a1a;
    height: 25px;
    padding: 5px;
    width: 350px;
    margin: 50px0;        
    border-radius: 5px;
    box-shadow: 01px5px#000inset, 01px0#444;          
}
 
.progress-barspan {
    display: inline-block;
    height: 100%;
    border-radius: 3px;
    box-shadow: 01px0rgba(255,255,255,.5)inset;
    transition: width.4sease-in-out;   
    background-color:#a5a5a5;
}

Output

Stylish CSS3 progress bars

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: 50px0;        
    border-radius: 5px;
    box-shadow: 01px5px#000inset, 01px0#444;          
}
 
.progress-barspan {
    display: inline-block;
    height: 100%;
    border-radius: 3px;
    box-shadow: 01px0rgba(255,255,255,.5)inset;
    transition: width.4sease-in-out;   
    background-color:#a5a5a5;
}
 
.bluespan {
    background-color: #34c2e3;  
}
 
.orangespan {
      background-color: #fecf23;
      background-image: linear-gradient(top,#fecf23,#fd9215); 
}  
 
.greenspan {
      background-color: #a5df41;
      background-image: linear-gradient(top,#a5df41,#4ca916); 
}
 
.stripesspan {
    background-size: 30px30px;
    background-image: linear-gradient(135deg,rgba(255,255,255,.15)25%,transparent25%,
                        transparent50%,rgba(255,255,255,.15)50%,rgba(255,255,255,.15)75%,
                        transparent75%,transparent);           
   
    animation: animate-stripes3slinearinfinite;            
}
 
@keyframesanimate-stripes {
    0% {background-position: 00;} 100% {background-position: 60px0;}
}

 

Output

Stylish CSS3 progress bars

Shine

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

HTML

<divclass="progress-bar blue stripes">
    <spanstyle="width: 40%"></span>
</div>
<divclass="progress-bar orange shine">
    <spanstyle="width: 100%"></span>
</div>
<divclass="progress-bar green stripes">
    <spanstyle="width: 50%"></span>
</div>

 

CSS

.progress-bar {
    background-color: #1a1a1a;
    height: 25px;
    padding: 5px;
    width: 350px;
    margin: 50px0;        
    border-radius: 5px;
    box-shadow: 01px5px#000inset, 01px0#444;          
}
 
.progress-barspan {
    display: inline-block;
    height: 100%;
    border-radius: 3px;
    box-shadow: 01px0rgba(255,255,255,.5)inset;
    transition: width.4sease-in-out;   
    background-color:#a5a5a5;
}
 
.bluespan {
    background-color: #34c2e3;  
}
 
.orangespan {
      background-color: #fecf23;
      background-image: linear-gradient(top,#fecf23,#fd9215); 
}  
 
.greenspan {
      background-color: #a5df41;
      background-image: linear-gradient(top,#a5df41,#4ca916); 
}
 
.stripesspan {
    background-size: 30px30px;
    background-image: linear-gradient(135deg,rgba(255,255,255,.15)25%,transparent25%,
                        transparent50%,rgba(255,255,255,.15)50%,rgba(255,255,255,.15)75%,
                        transparent75%,transparent);           
   
    animation: animate-stripes3slinearinfinite;            
}
 
@keyframesanimate-stripes {
    0% {background-position: 00;} 100% {background-position: 60px0;}
}
 
.shinespan {
    position: relative;
}
 
.shinespan::after {
    content: '';
    opacity: 0;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: #fff;
    border-radius: 3px;
    animation: animate-shine2sease-outinfinite;            
}
 
@keyframesanimate-shine {
    0% {opacity: 0; width: 0;}
    50% {opacity: .5;}
    100% {opacity: 0; width: 95%;}
}

 

Output

Stylish CSS3 progress bars

Glow

CSS3 keyframes animation based on box-shadow property:

.glowspan {
    box-shadow: 05px5pxrgba(255,255,255,.7)inset, 0-5px5pxrgba(255,255,255,.7)inset;   
    animation: animate-glow1sease-outinfinite;         
}
 
@keyframesanimate-glow {
 0% { box-shadow: 05px5pxrgba(255,255,255,.7)inset, 0-5px5pxrgba(255,255,255,.7)inset;}
 50% { box-shadow: 05px5pxrgba(255,255,255,.3)inset, 0-5px5pxrgba(255,255,255,.3)inset;}
 100% { box-shadow: 05px5pxrgba(255,255,255,.7)inset, 0-5px5pxrgba(255,255,255,.7)inset;}
 }

 

Output

Stylish CSS3 progress bars


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


Updated 07-Sep-2019
I am a content writter !

Leave Comment

Comments

Liked By