CSS

Review Page

The translate() Method

The translate() method moves an element from its current position:

This div element is moved 50 pixels to the right, and 100 pixels down from its current position.
This div element is moved 50 pixels to the right, and 100 pixels down from its current position.
This div element is moved 50 pixels to the right, and 100 pixels down from its current position.

The rotate() Method

The rotate() method rotates an element clockwise or counter-clockwise.

This div element is x and y.
This div element is rotated clockwise 20 degrees in the x axis.
This div element is rotated clockwise 20 degrees in the y axis.

The scale() Method

The scale() method increases or decreases the size of an element.

This div element is two times of its original width, and three times of its original height.

The scaleX() Method

The scaleX() method increases or decreases the width of an element.

This div element is two times of its original width.

The scaleY() Method

The scaleY() method increases or decreases the height of an element.

This div element is three times of its original height.

The skewX() Method

The skewX() method skews an element along the X-axis by the given angle.

X-axis Y-axis by the given angle.

This div element is skewed 20 degrees along the X-axis.
This div element is skewed 20 degrees along the Y-axis.

The matrix() Method

The matrix() method combines all the 2D transform methods into one.

This a matrix div element.
Using another matrix() method.
Another use of the matrix() method.

translate 3D

translate 3D

The rotateZ() Method

The rotateZ() method rotates an element around its X-axis at a given degree.

This a normal div element.
This div element is rotated 150 degrees.

The rotateY() Method

The rotateY() method rotates an element around its Y-axis at a given degree.

This a normal div element.
This div element is rotated 150 degrees.

The rotateZ() Method

The rotateZ() method rotates an element around its Z-axis at a given degree.

This a normal div element.
This div element is rotated 90 degrees.

The transition Property

Hover over the div element below, to see the transition effect:

transition

delay

duration

property

timing function

CSS Animation background

Note: When an animation is finished, it goes back to its original style.

CSS Animation background and position

Note: When an animation is finished, it goes back to its original style.


CSS Animation delay

The animation-delay property specifies a delay for the start of an animation. The following example has a 2 seconds delay before starting the animation:


CSS Animation repetitions

The animation-iteration-count property specifies the number of times an animation should run. The following example will run the animation 3 times before it stops:


CSS Animation reverse direction or alternate cycles

The animation-direction property specifies whether an animation should be played forwards, backwards or in alternate cycles. The following example will run the animation in reverse direction (backwards):


CSS Specify the Speed Curve of the Animation

The animation-timing-function property specifies the speed curve of the animation. The following example shows some of the different speed curves that can be used:

linear
ease
ease-in
ease-out
ease-in-out

CSS Animation Specify the fill-mode

Let the div element get the style values set by the first keyframe before the animation starts (during the animation-delay period):


CSS Animation Shorthand

This example uses the shorthand animation property: