Placed in: Home arrow Programming arrow CSS arrow Animated wicked CSS3 3d bar chart
Animated wicked CSS3 3d bar chart

Do you remember the Wicked CSS3 3d bar chart that I placed online a couple of weeks ago? Paul Irish left a comment, requesting for an example with transitions. My reply was that I was already working on that, and today I'm proud to release the animated wicked CSS3 3d bar chart.

The principle is the same as the previous version: Create a beautiful 3d bar chart. But this time, we don't create a "stacked" one (since animation would be hard), but several bars placed under each other. When hovering, the animation shows and the bar will grow to the appropriate size.

Animated wicked CSS3 3d bar chart

One of the neatest things of this example (in my opinion), is that it uses the exact same HTML (except for the title) as the original article (wicked CSS3 3d bar chart). It's a great example to show what you can do with flexible CSS; You can create a totally different page with the same HTML and using only a different style sheet file.

Demo Animated wicked CSS3 3d bar chart   Download Animated wicked CSS3 3d bar chart

Take note that this example only works in -webkit based browsers (Safari and Chrome), because those are the browsers that currently only support CSS3 animation (The next version of Firefox will support animations too). So, once again, this example is just a sneak peak into some awesome stuff CSS3 can do for us.

Video

Here's an example of the page showed in Safari (4.0). It shows all the effects as they should should (rounded corners, gradients, shadow, rgba etc.), but most importantly: The animations.

I guess I warmed you up on how you could create something like this yourself, haven't I? Let's take a look under the hood.

HTML

Like I said, we're going to use the exact same same HTML structure as with the wicked CSS3 3d bar chart.

 
<ul id="bar">
   <li id="iphone">
      <div class="top">
         <img src="images/iphone.png" alt="iPhone" />
      </div>
      <div class="bottom">
         <div class="infobox">
            <h3>iPhone</h3>
            <p>80,1</p>
         </div>
      </div>
   </li>
   <!-- More bar chart items -->
</ul>

As you can see, we're simply using an unordered list that contains several items (the bars). Each bar contains from two segments: The Top and the Bottom. We'll use the magic of CSS to style the top (which also contains the image) to an ellipse (top of the bar). The bottom (the bar body), that contains the info of the bar, will be styled to have a pretty rounded border too.

Now on to the more interesting stuff: The CSS(3) we need in order to create this neat effect.

CSS

The .top and .bottom classes are almost identical to the previous version (check out that tutorial to see how those were created). The only difference is that we now need to rotate the ellipse, since the bars are rotated too. Check out the most important changes:

 
#bar li div.top { float:left; margin-left:10px;
   width:40px; height:100px; -moz-border-radius: 40px/100px; -webkit-border-radius: 40px 100px; border-radius: 40px/100px;
   -webkit-transition-property: margin-left;
   -webkit-transition-duration: 500ms;
}
 
#bar li div.bottom { width:50px;
   height:100px; -moz-border-radius: 40px/100px; -webkit-border-radius: 40px 100px; border-radius: 40px/100px;
   -webkit-transition-property: width;
   -webkit-transition-duration: 500ms;
}

The .top class has a transition-property set to margin-left, since it'll need to move to the right when hovering. The .bottom class has a transition-property set to width, since it needs to expand/grow when hovering. The duration is both set to 500ms, but that can easily be changed.

Now we need to specify the new values for each product individually. Here's an example for the iPhone:

 
#iphone:hover div.top {
   margin-left:160px;
}
 
#iphone:hover div.bottom {
   width:200px;
}

Because the transition-property have been set to act to the specified properties, the animation works as expected. The .top will move to the right, and the .bottom will expand/grown in width. Because of this syntax, other browsers like Firefox will show the expansion too, but without the animation.

This is actually the most important change when compared to the previous version. Yet, there's one neat animation in the text (.infobox) that I would like to show too.

 
#bar li div.bottom div.infobox {
   -webkit-transition-property: color;
   -webkit-transition-duration: 500ms;
}
 
#bar li:hover div.bottom div.infobox {
   color:#eee;
}
 
#bar li div.bottom div.infobox p {
   opacity: 0;
   -webkit-transition-property: opacity;
   -webkit-transition-duration: 500ms;
}
 
#bar li:hover div.bottom div.infobox p {
   opacity:1;
}

The .infobox has a title and a paragraph with a number. The infobox will slowly fade to another font color, and the paragraph with a number will slowly fade in by changing the opacity from 0 to 1. These are the small things that give the design that little bit extra.

Those were the most important changes compared to the wicked CSS3 3d bar chart. Check out the CSS in the example/download to see the full CSS.

Conclusion and Download

Just like with the previous example, this one only works in certain browsers. Yet, it's a pretty cool example to see what CSS3 (animations) can do. Just for the record, Yes, you can create this effect using jQuery too. Yet, I wanted to keep this a full CSS solution, so that's why I used the transition for this effect.

Demo Animated wicked CSS3 3d bar chart   Download Animated wicked CSS3 3d bar chart

What do you think of this technique? What else would you like to see in this CSS? Feel free to share your thoughts!


Tags:  animation css3 bar chart 3d

Interested in this topic? You might enjoy another article I've written called

Did you like this article? Subscribe to my feed or email to keep updated on new articles.

Spread the word and submit to:
Digg!Reddit!Del.icio.us!Facebook!StumbleUpon!
Comments
Add NewSearchRSS
Webstandard-Blog   2010-06-07 09:48:05
Gravatar image Very nice idea and I think (hope) this kind of charts will be the future.
Martin   2010-06-07 10:04:28
Gravatar image Cool concept! I was also thinking of making an Apple-inspired tutorial this week, but guess it will have to wait ;)
Dainis Graveris   2010-06-08 15:57:19
Gravatar image Hehe, man! This is sick tutorial, I didn't know this is even possible! Mad skillzz ! :)
sbuster - I ike   2010-06-08 17:17:21
Gravatar image Nice tutorial
Rad   2010-06-09 12:39:18
Gravatar image You use :hover, it won't work on iPad. Sorry.
Marco - True   2010-06-09 17:20:34
Gravatar image Yup; for it to work on the iPad, you'll need some JavaScript to make it to work as well. Still hope you liked the script!
Rilwis - Love it   2010-06-09 12:40:07
Gravatar image Very creative way of using CSS3. I love the bar :). Thanks for sharing.
LD - Useless   2010-06-09 12:40:44
Gravatar image Completely useless!

The purpose of bar charts is to compare the size of the bars. But with this you can only see 1 bar at a time.
Superdopey - Nice!   2010-06-09 13:01:15
Gravatar image Nicely done.

To the guy above me: the purpose of this demo is to show how you can make a nice graph using CSS3.

Besides the source is available, so you can change it to the behaviour you want.
Marco - Exactly   2010-06-09 17:19:18
Gravatar image Exactly Superdopey, you totally understand! The previous example has no animation and is probably more useful, but this one is just a great example on what CSS3 can do ;) .
Beben - Prodigy of Head   2010-06-09 14:22:56
Gravatar image its a cool B)
Marco - Thanks!   2010-06-09 17:18:30
Gravatar image @Webstandard-Blog, @Martin, @Dainis, @sbuster, @Rilwis, @Beben
Thanks a lot for those kind words, really appreciate it! I'm glad you like this example :) .
Daniel Knell   2010-06-10 06:42:05
Gravatar image Would the animation not had better served as an initial effect, resizing the bars to their required size?

At the moment it kind of ruins the usability of the chart, as you can no longer compare the values visually when you can only see one at a time that's not possible.

The bells and whistles CSS3 brings should be used to enrich the experience not detract from it.
udaipur hotels - udaipur hotels   2010-06-10 16:32:29
Gravatar image thanks for sharing of information with us. It's really great article
Rajnish   2010-06-10 21:41:27
Gravatar image Hey, Thanks for sharing this. I would like to tell you, This is extremely wonderful and I really liked it.
I always like to read on these topics and one of the best thing is that,
I am looking for this from a long time. Thank you for this again.

Rajnish Kumar
cyb   2010-06-10 22:07:09
Gravatar image Very interesting. This will help me alot!
Charon - Excellent   2010-06-11 08:24:48
Gravatar image Very nice post. I like your image you use. It is nice to see someone confident enough to use their own sites to help others. Thanks again for sharing
tee are   2010-06-22 13:23:26
Gravatar image thanks for the sharing.. i'm newbie in css so this will be a great help for me
Fedor Indutny - User-select   2010-06-25 08:43:18
Gravatar image Why you're not using "-webkit-user-select: none" in your examples?
Mickey - Lovely   2010-07-06 09:08:54
Gravatar image Its great :lol:
soimon   2010-07-19 14:28:11
Gravatar image Nice experiment :D
I really like the new features in CSS3, but I think some of them are a little far-fetched. Animation is great, but that's where javascript is made for in my opinion. I like ways to finally reduce the amount of slicing you have to do to make a simple box with round corners, but I don't want a "loginanddisplayusername: true;" properties to exist :P

I would also like them to get rid of the webkit- and -moz pre and suffixes...
Adam Cooper - I love hacking on CSS.   2010-07-24 22:32:22
Gravatar image Great details here. I love hacking on CSS.
Julian   2010-09-02 21:02:59
Gravatar image Is it possible to animate the bars to the left?
Lighting - Agreed   2010-09-22 15:24:30
Gravatar image It is wicked just as the description - thanks
Frank Further - Pretty Cool   2010-09-30 04:55:04
Gravatar image Hey really great example. Who needs flash. heh
janu - Bit more Animation   2010-10-07 17:38:36
Gravatar image Marco,

Awesome stuff man. I would like to know whether you have any reference for my requirement.

Basically i wanted to show work progress .But the chart should be animated, every time it gets the data from the database it refreshes the pages and whoever is the lead will be shown using a sporty car moving so fast inside the bar of that person and stops at the end of the bar.

Don't know where to start? your help would be grateful

thanks
Jim - Why brother?   2010-10-12 21:46:55
Gravatar image The whole idea of a graph is to compare items - why would I want to move my mouse around to recheck graph positions! Move on...
Glow - great   2010-10-14 09:55:21
Gravatar image awesome, CSS3 have done the flash's job. B)

I visited this page via smashingmagzine.
clarinet repair - hurrah   2011-02-27 17:18:08
Gravatar image wanted to show work progress .But the chart should be animated, every time it gets the data from the database it refres
clarinet repair
güvenlik kamera sistemleri   2011-05-28 16:55:38
Gravatar image thnk
top drug store guide - top drug store guide   2011-06-09 04:29:08
Gravatar image The information which I had found in this blog was really very cordial and I had liked it very much. Thanks a lot for the information.
secure weightloss pills - secure weightloss pills   2011-06-09 04:31:25
Gravatar image This site was really very interesting and I had got impressed with this stuff. Thanks a lot for the lovely information which was given in this blog.
diet side effects journal - diet side effects journal   2011-06-09 04:32:32
Gravatar image I had really enjoyed viewing this blog. The information was really very cordial and it was very helpful for me. Thanks a lot for the stuff.
hair lack side effects reviews - hair lack side effects reviews   2011-06-09 04:33:26
Gravatar image I am very glad to post a comment on your blog as I really enjoyed reading your posts.
perfect anti smoking pills - perfect anti smoking pills   2011-06-09 04:34:57
Gravatar image The information provided was extremely useful and informative. Thanks a lot for useful stuff.
hair loss male pills reviews - hair loss male pills reviews   2011-06-09 04:35:48
Gravatar image This article is so interesting I am completely engrossed. Really I appreciate the efforts you take for making these posts. Thanks for sharing with us such useful information.
better pharmacy - better pharmacy   2011-06-09 04:36:26
Gravatar image I really enjoy reading your well written articles. I think you spend numerous effort and time in posting the blog. I have bookmarked it and I am looking ahead to reading new articles. Keep up the good articles!
secure fat loss pills - secure fat loss pills   2011-06-09 04:37:06
Gravatar image You are awesome people and bring great info; I definitely look forward for your work as I am a regular visitor of your site. Thanks a lot, superb work!!!!!
pharmacy hub info - pharmacy hub info   2011-06-09 04:37:47
Gravatar image I am strongly associated with this site. As this site has inspired me a lot always in a new way and made my work easy by every time highlighting on the new issue and make me pleased. Thanks you people rock!!!!!!
pharmacy tips - pharmacy tips   2011-06-09 04:38:28
Gravatar image I am frequent reader of the articles and new knowledgeable post about new things always and would be searching new stuff for that. And I really thank you people for providing us new articles and post. Thanks a lot!
best pharmacy hub info - best pharmacy hub info   2011-06-09 04:39:02
Gravatar image It was really surprising to see such a wonderful post that is inspiring and informative and caught the attention of many people. I am a regular visitor of the blog and love the work of these people.
best hair color loss online - best hair color loss online   2011-06-09 04:39:42
Gravatar image This is a wonderful website that has great info and is helpful for one and all. I always look forward for your website to gather any kind of information. Hope you people do like this only wonderful job. Cheers
online retail pharmacy usa - online retail pharmacy usa   2011-06-09 04:40:25
Gravatar image I often like surfing on net and find info on new things and this time I got a new website which has great info and is quite brilliantly written. Am just thrilled and excited to see this and hope to see more work of you people in future.
birth control pills club - birth control pills club   2011-06-09 04:41:05
Gravatar image You guys are really wonderful who search and bring such a wonderful info, I am glad to see this time also a useful stuff that had inspired me. Thanks a lot do keep giving us genuine stuff
herbal hair surgery loss - herbal hair surgery loss   2011-06-09 04:41:47
Gravatar image I enjoy reading the post and have become a great fan of yours. Keep up with the good job and please provide us with great blogs. I really appreciate the research you people take for the posts.
cewo - kamera   2011-06-20 20:02:38
Gravatar image thank you so much
cewo - kameralar   2011-06-20 20:04:50
Gravatar image thnk you
cewo - KAMERALARI   2011-06-20 20:05:35
Gravatar image TNK
cewo - KAMERALAR   2011-06-20 20:06:18
Gravatar image TNNK
austin defense lawyers   2011-07-15 06:06:29
Gravatar image It is really refreshing to see a music artist who is real and didn't let him becoming a star going to his head i not really in to rap but i like his song maybe it is because they lyrics are so down to earth.
Ricardo   2011-07-15 06:08:30
Gravatar image What a wonderful idea! That
Alex   2011-07-20 13:17:55
Gravatar image WOW, great :woohoo:
Dav   2011-07-25 21:38:26
Gravatar image thanks for sharing of information. It's really great,
Plumbing Pembroke Pines   2011-08-02 05:56:34
Gravatar image I strongly think that the expertise provided is highly relevant to almost everyone . Thank you .
hirmani80   2011-08-02 06:55:15
Gravatar image I had really like it very much for using the great technology is visible in this blog. This info is very great info by using the great services in this blog. Thanks a lot for providing the nice info in this blog
swimming pool solar cover - swimming pool solar cover   2011-08-05 10:41:47
Gravatar image Nice articles are providing in this website that to very impressive with this website and the great technology in this blog. I am very happy for visiting the great technology in this blog. This website is providing the number of topics that to some points are visible in this website. I had really like it very much for using the nice info in this blog. Thanks a lot for visiting the great info in this blog.
Jane Whitfield   2011-08-15 09:23:49
Gravatar image Thanks for the source code, this is a gorgeous 3d bar chart which we can use for our client's buy silverwebsite in the UK.
Richad Timms - Thanks   2011-08-25 23:37:25
Gravatar image Thanks good information.

Also i like the header image on your website very nice

Good job!

:cheer:
Photoshop Warrior - What a Nice Idea!!   2011-09-12 14:18:25
Gravatar image What a nice idea!!! I think these 3d bar is the future, we are way to the future now :)
Dav - Thanks again   2011-11-08 15:07:06
Gravatar image awesome, great staff ,very useful,just used on my page, thanks again
Kristin Warren - sharing your knowledge   2011-11-21 12:13:52
Gravatar image Thank you for sharing your knowledge about this CSS animation. I will try this at after my pmp exam time at PMP Houston.
ba - araç kameras   2011-12-06 22:39:34
Gravatar image lol. :evil:
ibrahim AVCI - Araç kameralar   2011-12-06 22:41:21
Gravatar image thank you for sharing just on my page
ibrahim AVCI - kamera   2011-12-06 22:42:47
Gravatar image <img src=illy:' /> THNk
pmp - very nice animation   2011-12-12 11:54:31
Gravatar image This is very nice animation that you have shared. It is really interesting. I would to change my site that can be look like this.
Jeany Doyle - awesome animation   2012-01-03 07:13:03
Gravatar image This is awesome animation that you have shared in here. I can
onlineearnings - Online earnings   2012-01-15 11:19:12
Gravatar image oh , really I am surprised by seeing your site information. It is a great
article for me. Ya , I think it
onlineearnings - markating   2012-01-15 11:23:27
Gravatar image the article is so helpful and attractive. It is full of useful material
and many information which can be easily understand
Jedi Force - Jedi Force   2012-01-15 11:31:22
Gravatar image this is very exciting and helpful for me. i am seeking for many days such site.ya this is a great work
alisaalba - http://jobatweb.com/   2012-01-15 11:33:00
Gravatar image hey, this is a very amazing site for me and i become
very helpful for me. its really a top class solution for us.
a lot of informatic material are posted on this site......
Pithagoras - WOW!   2012-01-15 19:09:07
Gravatar image I keep on being amazed at what is possible with css3, thanks!!
digital led displays - DDD   2012-02-03 04:26:25
Gravatar image To say the truth I am very impressed by what you told. You share tons of interesting info, neat and excellent design you
sugar land dental - GGG   2012-02-03 04:30:04
Gravatar image What a wonderful idea! That
Norbert - Nice Website   2012-02-11 22:07:07
Gravatar image :lol: Your Website is great. I like this design... Respect
Jacob Panse - Training In C#   2012-04-06 12:21:16
Gravatar image It's really appreciating article.I used to search for these sort of article always.Thanks for sharing your creative writing abilities.
manchester escort agency - manchester escort agency   2012-04-06 13:12:31
Gravatar image Thanks for sharing your blog and good content for outher website
Digital cameras - Digital cameras   2012-04-13 08:49:01
Gravatar image Digital Cameras have become a common site wherever you go. If you're getting ready to purchase your first digital camera, or maybe you're looking to replace one you already have, it is best to familiarize yourself with the knowledge of what makes one digital camera different from another and choose the one that is right for you.
Digital cameras - Digital cameras   2012-04-13 08:50:16
Gravatar image Digital Cameras have become a common site wherever you go. If you're getting ready to purchase your first digital camera, or maybe you're looking to replace one you already have, it is best to familiarize yourself with the knowledge of what makes one digital camera different from another and choose the one that is right for you.
Digital cameras - Digital cameras   2012-04-13 08:50:38
Gravatar image Digital Cameras have become a common site wherever you go. If you're getting ready to purchase your first digital camera, or maybe you're looking to replace one you already have, it is best to familiarize yourself with the knowledge of what makes one digital camera different from another and choose the one that is right for you.
Digital cameras - Digital cameras   2012-04-13 08:51:34
Gravatar image Digital Cameras have become a common site wherever you go. If you're getting ready to purchase your first digital camera, or maybe you're looking to replace one you already have, it is best to familiarize yourself with the knowledge of what makes one digital camera different from another and choose the one that is right for you.
Kimmy | Html5xcss3.com   2012-04-23 05:34:13
Gravatar image Awesome Css3, thanks for sharing.
Read more...
Name:
Email:
  Gravatar enabled.
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
 
Security Image
Please input the anti-spam code that you can read in the image.
Unsubscribe from e-mail notifications.
 
< Prev   Next >
Subscribe

Subscribe to Marcofolio