The best place to learn to use transitions and animations is John Allsopp’s tutorial.
Lea Verou’s Animatable gave me ideas for additional tests.
Transitions allow you to alter styles not abruptly, but subtly and with intermediate steps.
The essence is that you define normal styles and special styles that should be applied after, for instance, a click, and that you then command the browser to use a transition for the style changes. This makes sure the property change is subtle and gradual.
All browsers support only the prefixed versions. This fact is ignored in the table below.
Selector or declaration | IE 5.5 | IE 6 | IE 7 | IE8 | IE9 | IE10 pr2 | FF 11.0 Win | FF 10.0.2 Mac | Saf 5.1 Win | Saf 5.1.2 Mac | Chrome 18 Win | Chrome 17 Mac | Opera 11.61 Win | Opera 11.61 Mac | |||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
transition-property
Which property does the transition take place on?
|
No | Yes | Yes | Yes | Yes | ||||||||||||||
transition-duration
How long does the transition take?
|
No | Yes | Yes | Yes | Yes | ||||||||||||||
transition-timing
What is the exact timing of the transition?
|
No | Yes | Yes | Yes | Yes | ||||||||||||||
transition-delay
What delay does the transition have?
|
No | Yes | Yes | Yes | Yes | ||||||||||||||
Selector or declaration | IE 5.5 | IE 6 | IE 7 | IE8 | IE9 | IE10 pr2 | FF 11.0 Win | FF 10.0.2 Mac | Saf 5.1 Win | Saf 5.1.2 Mac | Chrome 18 Win | Chrome 17 Mac | Opera 11.61 Win | Opera 11.61 Mac | |||||
width
|
No | Yes | Yes | Yes | Yes | ||||||||||||||
background-color
|
No | Yes | Yes | Yes | Yes | ||||||||||||||
background-position
|
No | Yes | Yes | Yes | No | ||||||||||||||
border-color
|
No | Yes | Yes | Yes | Yes | ||||||||||||||
border-width
|
No | Yes | Yes | Yes | Yes | ||||||||||||||
left
|
No | No | Yes | Yes | Yes | ||||||||||||||
color
|
No | Yes | Yes | Yes | Yes | ||||||||||||||
font-size
|
No | Yes | Yes | Yes | Buggy | ||||||||||||||
|
|||||||||||||||||||
line-height
|
No | Yes | Yes | Yes | Incom |
||||||||||||||
|
|||||||||||||||||||
Selector or declaration | IE 5.5 | IE 6 | IE 7 | IE8 | IE9 | IE10 pr2 | FF 11.0 Win | FF 10.0.2 Mac | Saf 5.1 Win | Saf 5.1.2 Mac | Chrome 18 Win | Chrome 17 Mac | Opera 11.61 Win | Opera 11.61 Mac | |||||
text-indent
|
No | Yes | Yes | Yes | Yes | ||||||||||||||
letter-spacing
|
No | No | Yes | Yes | Yes | ||||||||||||||
margin-top
|
No | Yes | Yes | Yes | Yes | ||||||||||||||
padding-top
|
No | Yes | Yes | Yes | Yes | ||||||||||||||
opacity
|
No | Yes | Yes | Yes | Yes | ||||||||||||||
text-shadow
|
No | Yes | Incom |
Yes | No | ||||||||||||||
|
Here are tests for the vendor prefixes. Click on the test elements. These are also tests for transition-property
, transition-duration
, and width
.
No prefix
-webkit-
-moz-
-ms-
-o-
linear
ease
ease-in-out
ease-in
ease-out
Delay of 1 second.
background-position
Finally, scroll up a bit so that you have a good view of several test boxes, and zoom your browser. There should be no transitions.
Safari/Chrome bug: all transitions are applied when you zoom. This should not happen, and does not in fact happen in Firefox and Opera.
These properties are impossible to animate because there are no intermediate values. An element is either visible or invisible, a text is either bold or normal.
Sometimes the browser supports transitions nonetheless; you’ll find out by the slight delay in the applying of the new styles. This delay is really the time the transition would take.