Look Inside

Howdy! Recently I discovered a very cool and interesting CSS3 tutorial about creating pure CSS3 progress bars from Chris Coyier page. Hence today I decided to try it with my own skill and share it with you all. Check out the outcome from Demo page.

The main techniques involved in this CSS3 progress bars tutorial are CSS3 background gradient effects combined with CSS3 animation property, that’s all! No images are needed. Check the browsers compatible picture below for best results.

[browser type=”cfs-x”]This working demo only works in browsers that support the respective CSS3 properties.[/browser]

The HTML Markup

The basic HTML markup for each progress bar is pretty simple. A

container with a class of bar as progress container and a child element as current progress area.

<div class="bar">
<span></span>
</div>

To create extra effects on progress bar, I have added different CSS classes on each progress bar, for instance, gradient class will create gradient effect and stripe class will generate stripe pattern on progress bar.

In following tutorial I will talk about the CSS properties of these classes.

The Base CSS

It’s hard for me to explain all the classes used in demo page one by one right here. So I decide to discuss some of them only since most of them are pretty straight forward or similar. Of course you can still find them all inside source files.

Well, let’s keep going with the base CSS. It will contains 2 parts, a container with bar class and its child element, .

Some of these properties like width and height can be adjusted to suit your layout.

Gradient Effect

I use CSS3 box-shadow property to create the gradient effect for progress bar rather than using CSS3 gradient background. I preserve gradient background for other styling as it can do MORE than just a gradient effect.

Since IE8 and below doesn’t support complicated CSS3 gradient background, thus I apply filter property on this class as well as a fallback. At least our progress bar won’t be displaced as plain color in IE. =)

Gloss Effect

Gloss effect can be generated by using CSS background gradient property as below. This will create a semitransparency gloss effect on top of progress bar, which mean it can integrate into any color of progress bar.

Stripe Effect

Same goes to stripe effect. We can generate stripe pattern through CSS3 gradient background property, and same as gloss effect, I will create a partial transparency stripe pattern so that it can apply to any color of progress bar.

Not only these, we can generate even more effect through gradient background as you can see in demo page.

Animation

It is easy to have an animated progress bar with help from CSS3 animation property. Change the values of animation and keyframes as you like and attach the animate class to any <span> to make the progress bar animated.