Over a million developers have joined DZone.

CSS3 Transitions, Hover Effects, and Two Different Kinds of Interactivity

DZone's Guide to

CSS3 Transitions, Hover Effects, and Two Different Kinds of Interactivity

· Web Dev Zone
Free Resource

Start coding today to experience the powerful engine that drives data application’s development, brought to you in partnership with Qlik.

This CSS3 hover tutorial caught my eye -- but also fired a recent designer's rant in my memory. Why do these hover effects, by Alessio Atzeni, look cooler than these?

The former is animated, of course, while the latter is not. Animation alone increases the sense of interactivity -- from infancy, even. But then what's the difference between this animation (flying zoom) and this one (sideways slide)? The CSS elements themselves are straightforward (scale and translate with ease-in-out) -- but why use one and not the other?

These are designers' questions, I suppose, and accordingly rather beyond me. But comparing these two CSS hover tutorials (1,2), especially the multiple transition&animation variations demoed here, gives a clear sense of how CSS3 allows a small change in the developer's code to make a really significant difference in the user's experience.

Alessio's 'true bounce effect' in Example 8 is particularly neat. At the heart is this keyframe rule -- easy to understand in principle, but remarkably well executed:

@keyframes bounceY {
2	    0% { transform: translateY(-205px);}
3	    40% { transform: translateY(-100px);}
4	    65% { transform: translateY(-52px);}
5	    82% { transform: translateY(-25px);}
6	    92% { transform: translateY(-12px);}
7	    55%, 75%, 87%, 97%, 100% { transform: translateY(0px);}
8	}

The trick lies, obviously, in the exact relation between the timing percents and the translationY distances. Alessio doesn't explain exactly how he selected these numbers, but they were certainly well-chosen.

These are the kinds of super-concrete details I find especially helpful in a tutorial like this -- where individual tips are concrete, but surrounded by a large enough number of variations that very different pages can benefit from a considerable variety of user experiences produced by fairly similar bits of code. You might want to keep this tutorial page as a go-to guide for high-quality and easy-to-code CSS3 transition and animation effects.


Create data driven applications in Qlik’s free and easy to use coding environment, brought to you in partnership with Qlik.


Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}