
- Getting Started – what you must have on your workstation
- The Basics of the Basics – what you should know about transitions
- The Basics – what you must know about CSS3 Transitions (demo section)
- Conclusions – are we there yet?
- External Resources – places where you must visit after reading this article

Getting Started
To get started, you’ll need a browser that supports CSS3 Transitions:- Apple Safari (supported in Safari 3.1 and later, and in iPhone OS 2.0 and later.)
- Google Chrome
- Mozilla Firefox 3.7 alpha (also known as Minefield)
- Opera 10.5x (also supported by Opera Mobile 10 beta 2)
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
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;Duration:
-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
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);}
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; transform:rotate(360deg);} #rotateEasing:target {left:200px; transform:rotate(360deg);}
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;}
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).

Conclusions
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
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.- Safari CSS Visual Effect Guide: Transitions
- Mozilla CSS transitions – MDC
- Opera: CSS3 Transitions support in Opera Presto 2.3
- CSS3.info
- CSS3, Please! The Cross-Browser CSS3 Rule Generator
- CSS Fundamentals: CSS 3 Transitions | NetTuts+
- CSS Transitions 101 | Webdesigner Depot
- Going Nuts with CSS Transitions | 24 ways
- Safari CSS Visual Effect Guide: Animations