Using CSS3 Transforms

Posted: November 23, 2011 in CSS
Tags: , , , , ,

How to use CSS3  transforms

There are two categories of transform – 2D transforms and 3D transforms. As of May 2010, 3D transforms only work in Safari (both desktop and mobile). 2D transforms are more widely supported.

2D examples

#skew {
#scale {
#rotate {
#translate {
	transform:translate(10px, 20px);
#rotate-skew-scale-translate {
	transform:skew(30deg) scale(1.1,1.1) rotate(40deg) translate(10px, 20px);

3D Examples

3D transforms are similar to 2D transforms. The basic properties are translate3d, scale3d, rotateX, rotateY and rotateZ. Translate3d and scale3d take three arguments for x,y and z, whereas the rotates just take an angle. Here are some examples:

#transDemo4 div {
	transition:all 2s ease-in-out;
	perspective: 800;
	perspective-origin: 50% 100px;
#transDemo4:hover #rotateX {
#transDemo4:hover #rotateY {
#transDemo4:hover #rotateZ {

For more information read both the Webkit blog entry from when this was first implemented, and David Desandro’s awesome examples.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s