A quick overview of the CSS transform & transition properties for animating websites.
Transforms & transitions
CSS has a bunch off different effect properties built-in, with slightly different features.
We’ll look at the two easier ones this week: transform & transition
transform
transition
Visual effects that can be applied to any HTML element; but, by themselves, they are not interactive.
<div class="violet"></div> <div class="purple"></div> <div class="green"></div>
.violet { transform: rotate(33deg); } .purple { transform: skew(24deg); } .green { transform: scale(1.5) rotate(-6deg); }
Transitions are user initiated easing effects. When a user interacts with an element we can apply some kind of easing-like animation.
padding
color
<a class="btn" href="#">T-Rex!</a>
.btn { background-color: #5e54af; transition: all 200ms linear; } .btn:hover { background-color: #3c3670; }
CSS animations & effects ➔ CSS animations & effects cheat sheet ➔