I’m Dudley Storey, the author of Pro CSS3 Animation. This is my blog, where I talk about web design and development with , and . To receive more information, including news, updates, and tips, you should follow me on Twitter or add me on Google+.

web developer guide

my books

Book cover of Pro CSS3 AnimationPro CSS3 Animation, Apress, 2013

my other blogs

Massive Head Canon: Intelligent discussion of movies, books, games, and technology.

my projects

A Sass color keyword system for designers. Replaces CSS defaults with improved hues and more memorable, relevant color names.

CSSslidy: an auto-generated #RWD image slider. 3.8K of JS, no JQuery. Drop in images, add a line of CSS. Done.

tipster.ioAutomatically provides local tipping customs and percentages for services anywhere.

CSS Transformations: Introduction

css / transforms

Estimated reading time: 1 minute, 30 seconds

Making elements look different under certain conditions has always been possible in , often initiated by simple pseudo-classes like :hover. CSS transforms, coupled with keyframes and transitions, simply extend this capability into movement and animation.

This ability runs up against traditional uses of and Flash, and is beginning to supplement and replace both in these areas. With the growth of HTML5, CSS and related technologies, JavaScript is slowly being shifted back to where it is most appropriate: in browser interaction and scripting, rather than for appearance or effects.

Transforms are officially still in working draft status at the W3C. Chrome, Safari and Opera still use vendor prefixes for the transform property; IE and Firefox do not. The base transformations are rotate, skew, scale and translate, with a matrix property to allow all four transformations to be implemented at once. In many ways, scale and translate are just handy alternatives to manipulating the properties left, top, right, bottom, width and height, but skew and rotate are completely new.

By default transforms take place from the computed centre of an element. In order to change this, you must alter the transform-origin property.

CSS transformations are supported in Opera 10.5+, Safari 3+, Firefox 3.5+, IE 9+ and all versions of Chrome.

To create a transformation, use the transform property and attach the transform you wish to use, with the appropriate values in parentheses. There are also , which we will approach later.

comments powered by Disqus

This site helps millions of visitors while remaining ad-free. For less than the price of a cup of coffee, you can help pay for bandwidth and server costs while encouraging further articles.