CSS3 Transitions – Are We There Yet?26th of Apr 2010 - Samuli Hakoniemi

CSS3 Transitions - Are We There Yet?
Cascading Style Sheets 3 has been available for “some time” (first time introduced nine years ago). However, CSS3 hasn’t been available in common use for more than two years. CSS3 Transitions in real use were introduced in late 2007 by Safari. At that time, they were referred as “CSS Animations”, but the terminology changed when Safari introduced their proprietary features also called CSS Animations I’ve split this topic in two articles. In this first article I’ll make a generic overview on CSS3 Transitions. Additionally, I’ll introduce some of the basic implementations and evaluate few CSS properties, meant for creating transformations and transitions. This article also contains references to excellent CSS3 articles. So after reading this article, go ahead and upgrade your knowledge about CSS3 Transitions with them.
This article is also published in Finnish, titled as “CSS3 Transitiot – olemmeko jo perillä?” at gfx.fi. Like mentioned above, the whole topic has been split in two parts. The first part is offering a general overview in current status of CSS3 Transitions. Second part is called “CSS3 Transitions – Problems and Solutions”, which will explain in details how CSS3 Transitions behave in different browsers. The first part of the article contains following sections: Getting Started

Getting Started

To get started, you’ll need a browser that supports CSS3 Transitions:

What about Internet Explorer?

At the moment it’s announced that Internet Explorer 9 isn’t going to support CSS3 Transitions. The best support for IE Transitions and Transformations can be achieved with Matrix Filter. Additionally, I recommend reading an article titled Cross-Browser Animated CSS Transforms — Even in IE, written by Zoltan “Du Lac” Hawryluk who is the author of cssSandpaper. The Basics of the Basics

The Basics of the Basics

Unfortunately, there’s no “one rule to rule them all” for transitions. Actually every browser has their own proprietary properties. Fortunately the syntax for values are consistent.

What can be transitioned?

Most properties can be transitioned and therefore I see no reason to list them here explicitly. However, there are some difference between browsers and the most obvious exception is that Firefox 3.7a doesn’t support transition of transformations at all.

The property values for transitions

Transitions have four values to declare at maximum: Shorthand:
-webkit-transition: property_name duration timing_function delay;
-moz-transition: property_name duration timing_function delay;
-o-transition: property_name duration timing_function delay;
transition: property_name duration timing_function delay;
You also can declare every value explicitly: (Target) Property:
-webkit-transition-property: property_name;
-moz-transition-property: property_name;
-o-transition-property: property_name;
transition-property: property_name;
-webkit-transition-duration: duration;
-moz-transition-duration: duration;
-o-transition-duration: duration;
transition-duration: duration;
Duration (like delay) can be entered either in seconds (eg. 0.5s) or in milliseconds (eg. 500ms). It’s important to note that if the value is entered without suffix, transition will not work at all. Timing (of motion):
-webkit-transition-timing-function: timing_function;
-moz-transition-timing-function: timing_function;
-o-transition-timing-function: timing_function;
transition-timing-function: timing_function;
Available timing functions:
  • cubic-bezier(cp1x, cp1y, cp2x, cp2y)
  • ease – equivalent to cubic-bezier(0.25, 0.1, 0.25, 1.0).
  • linear – equivalent to cubic-bezier(0.0, 0.0, 1.0, 1.0).
  • ease-in – equivalent to cubic-bezier(0.42, 0, 1.0, 1.0).
  • ease-out – equivalent to cubic-bezier(0, 0, 0.58, 1.0).
  • ease-in-out – equivalent to cubic-bezier(0.42, 0, 0.58, 1.0).
-webkit-transition-delay: delay;
-moz-transition-delay: delay;
-o-transition-delay: delay;
-transition-delay: delay;
Delay (like duration) can be entered either in seconds (eg. 0.5s) or in milliseconds (eg. 500ms). In general, it’s good to declare transitions on default state selectors without pseudo classes. This will cause transition played in both direction, eg. when hovering. Remember, you have to enter all the properties four times before being cross-browser compliant. Therefore it’d be best to use shorthand codes for keeping your CSS code clean. The Basics

The Basics

Now, I’m going to demonstrate some of the transitions. You must either hover or to click activation buttons for displaying transitions. All the code examples below has no browser proprietary format written – this is for saving space.

Basic Transition: Dimensions and Scaling

I’ll start by demonstrating the basic transition. It also demonstrates the difference between width+height and scale transform.
#widthHeight	{transition:all 500ms;}
#widthHeight:hover	{width:200px;height:200px;line-height:200px;}

#scale	{transition:all 500ms;}
#scale:hover	{transform:scale(2.0, 2.0);}
Width + Height

As you can see, width and height increases normally while scaling is treated almost like absolutely positioned element. On scaling, the transform-origin is set to middle while modifying width+height origin is on the top-left corner.

Transition with Timing Function

Below there are two blocks rotating; one with linear timing-function and second one with ease.
#rotateLinear	{position:relative;clear:both;left:0px;
		transition:all 2500ms linear;}
#rotateEasing	{position:relative;clear:both;left:0px;
		transition:all 2500ms ease;}
#rotateLinear:target	{left:200px;

#rotateEasing:target {left:200px;
Activate LinearActivate Easing

As you probably noticed, the movement is different but both transitions ends at the same time (after 2500ms).

Transition with Delay

Delays are useful in some cases. And they’re very easy to implement in transitions:

#bgColorDelay	{background-color:#12142B;
		transition:background-color 500ms linear 800ms;}
#bgColorDelay:hover	{background-color:#336699;}
800ms delay

Transition Chaining

Transitions can also be chained. This doesn’t come as a default feature, but chaining can be achieved by adding delay between transitions:

#widthHeightOpacity	{transition:width 500ms, height 500ms linear 500ms, opacity 500ms linear 1000ms;}
#widthHeightOpacity:hover	{width:200px;height:200px;opacity:0.1;}

This has one caveat: transitions are displayed in same order no matter whether the element is hovered or it’s in default state. And that makes no sense. Therefore we need to reverse the declarations (compared to earlier examples) as following:

#widthHeightOpacity	{
	transition:width 500ms 1000ms, height 500ms linear 500ms, opacity 500ms linear;

#widthHeightOpacity:hover	{width:200px;height:200px;opacity:0.1;
	transition:width 500ms, height 500ms linear 500ms, opacity 500ms linear 1000ms;

Is There Anything Else?

Well of course, there might be something else I haven’t noticed at this point. But what I’m trying to emphasize is that transitions are rather simple to implement (although they require a bit extra work for cross-browser compliancy).



Are we there yet? Yes, we’re over halfway there. Transitions in general are very cool in proper use. However, I’m personally still bit skeptic with CSS3 Transitions: at this point, you can’t rely on them and you must do cross-browser testing thoroughly. I’ll cover some of the problems at the following part of this article series. And I’m also going to briefly compare CSS3 Transitions with jQuery Animations. If you’re dealing with a platform solely running on WebKit (like iPhone or Adobe AIR) then go ahead and enjoy the full power of both CSS3 Transitions and WebKit animations. External Resources

External Resources

Here are some good resources provided both by browser vendors and other external authors. I strongly suggest reading them for adopting transitions and other CSS3 techniques.


Feel free to comment any part of the article. Additionally, if you know good resources about CSS3 Transitions, go ahead and contribute.

47 thoughts on “CSS3 Transitions – Are We There Yet?

  1. Great, well-written article!

    Seeing these examples inspire me to look into adding support for this inside cssSandpaper, and this article will be a very big help as a reference with its examples. If only IE supported great stuff like this natively … :-(

  2. Pingback: [User Link:CSS3 Transitions – Are We There Yet?] | Tips for Designers and Developers | tripwire magazine

  3. p6ril on said:

    Bravo, great post!

  4. Pingback: CSS Brigit | CSS3 Transitions – Are We There Yet?

  5. Pingback: [Linkdump #2] CSS3 na koniec tygodnia. « Tomasz Kowalczyk

  6. Pingback: Top Worthwhile Tutorials of the Week – #5 | AEXT.NET MAGAZINE

  7. Pingback: RPW 26/04/10: cacher les fichiers statiques, CSS3 transition, annonce Firefox 4, jeux en JS | BrainCracking - Veille technologique sur les applications Web

  8. Pingback: Cross-Browser CSS3 Rule Generator and Transition | DIGITALife

  9. Pingback: 140+ Inspirational Fresh Articles for Web Designers | tripwire magazine

  10. Deoxys on said:

    The link to Opera is incomplete…

  11. Samuli Hakoniemi on said:

    Thank you for notification, now it’s fixed. I also made some other minor improvements to article.

  12. David on said:

    Nice article!

  13. Pingback: CSS3 Transitions – Are We There Yet? | samuli.hakoniemi.net « Netcrema – creme de la social news via digg + delicious + stumpleupon + reddit

  14. Genc on said:

    thx for this awsome article!

  15. Pingback: 網站製作學習誌 » [Web] 連結分享

  16. Pingback: [Web] 連結分享 - 傑夫碎碎唸-有線電視、漫畫、PHP、Pushmail、Blackberry

  17. Really interesting stuff.

  18. fjpoblam on said:

    Scaling is *dramatic* for mi esposa’s art studio! And extremely easy to setup for “graceful degrade.” Thanks much.

  19. thanks for sharing such nice information..

  20. Pingback: Veckans länktips – 2010-05-02 | lillbra.se

  21. Pingback: 14 Best Fresh CSS3 Tutorials

  22. Pingback: 140+ Inspirational Fresh Articles for Web Designers — The Rawk Shop Literal

  23. Pingback: Modern CSS Layouts, Part 2: The Essential Techniques - Smashing Magazine

  24. Pingback: To do list – explore CSS 3 « Bloco de Notas

  25. Pingback: More CSS3 Goodies « MEDIA SALT

  26. Pingback: Some links for light reading (12/05/10) | Max Design

  27. Pingback: CSS3 Transitions « Ronald Jusuf's Virtual Ramblings

  28. Until IE actually supports this, its a no go for me. The company I work for expects all of our sites to look (for the most part) the same across all browsers. I’ll use javascript to do the basic animations until then. I still don’t know how I feel about CSS handling this kind of thing. Almost like we are using CSS to do too much. I’m sure I’ll get over that once transitions are fully supported.

  29. John on said:

    Until IE actually supports this, its a no go for me. The company I work for expects all of our sites to look (for the most part) the same across all browsers. I’ll use javascript to do the basic animations until then. I still don’t know how I feel about CSS handling this kind of thing. Almost like we are using CSS to do too much. I’m sure I’ll get over that once transitions are fully supported.

  30. Pingback: CSS Three — Connecting The Dots - Smashing Magazine

  31. Benjamin on said:

    The only way to force Microsoft to make IE standards compliant is to go ahead and start using CSS3. The more websites that are out there with CSS3 the better. People using IE will eventually see the a site that looks different (CSS3) to how they see it on their IE.

    And the chances of them wanting to continuously see that nice fresh looking version of what they’re used to seeing are good. They’ll then look into using another browser like Chrome, Safari or Firefox. Microsoft will begin to see, what would be, a massive drop in people using their browser and make them seriously consider becoming standards compliant.

  32. Pingback: 20 Useful CSS3 Tutorials and Resources | Template Monster Blog

  33. Pingback: TOPGFX » Blog Archive » CSS3 Transitions Transforms & Animation : Tutorials & Examples

  34. Pingback: Techniques and Tutorials for Using CSS3 « Arun Jacob – Web/User Interface Designer & Web Consultant

  35. This is a great overview that includes some examples and resources! Thanks for sharing.

  36. Brilliant article, well structured and happy about the external links as internet explorer is the bane of all evil for web designers.


  37. Pingback: Collection of CSS3 Tutorials – November 2010 « qeqnes | Designing. jQuery, Ajax, PHP, MySQL and Templates

  38. Pingback: 70 Must See CSS3 Tips, Tricks And Tutorials

  39. Pingback: CSS3 Transitions in we design – enriching the user experience

  40. Pingback: CSS3 Animation With jQuery Fallbacks

  41. Pingback: CSS3 Tutorials and Resources - WebsitesMadeRight.com

  42. thanks for sharing !

    this helps me so much ! thanks again !


  43. Pingback: CSS Transition Tutorials, Guides and Useful Tips | DesignFloat Blog

  44. James on said:

    Hello, anyone knows if its possible to make a menu when on hover the color changes from bottom to top?

  45. paillasse on said:

    Awesome, this article helps me very much !

    Thanks !


  46. Pingback: CSS3 generators « dynamisk5

  47. Pingback: Use css transitions make a powerful application’s animation with jquery as a fallback | JqueryHeaven