CSS - Transform

Transform

The transform property allows you to visually manipulate an element by skewing, rotating, translating, or scaling.

Transforming an element will change its position only visually, meaning its containing element will keep the original place and space of the transformed element.

monday logo

# Scale

Scale defines a transformation that resizes an element on the 2D plane. Because the amount of scaling is defined by a vector, it can resize the horizontal and vertical dimensions at different scales scale(x, y).

1
Direct Parent
1 =>  transform:  scale3d(1.5, 2, 1))

Hardware Acceleration: You can force the gpu to take control over the process, using the scale3d() function in order to achieve a smooth 60 frames per second animations without jittering or tearing. scale3d(x, y, z).

# Skew

The skew performs a shear transformation (also known as a shear mapping or a transvection), which displaces each point of an element by a given angle in each direction. Skewing an element is kind of like taking the points of an element, and pushing or pulling them in different directions, based on a given angle. skew(x, y).

1
Direct Parent
1 =>  transform:  skew(30deg, 20deg)

# Translate

This is probably the most useful property for animating the movement of elements. translate(x, y).

1
Direct Parent
1 =>  transform:  translate3d(0, -70%, 0)

Hardware Acceleration: You can force the gpu to take control over the process, using the translate3d() function in order to achieve a smooth 60 frames per second animations without jittering or tearing. translate3d(x, y, z).

# Rotate

This will allow rotating of an element by a specified number of degrees. rotate(deg).

1
Direct Parent
1 =>  transform:  rotate(30deg)

Hardware Acceleration: You can force the gpu to take control over the process, using the rotate3d() function in order to achieve a smooth 60 frames per second animations without jittering or tearing. rotate3d(x, y, z, a => angle).

# Transform-Origin

This property is used in conjunction with CSS transforms and define the base point for the transformation.
By default the transform-origin is set to center.

1
Direct Parent
1 =>  transform:  rotate(30deg)  |  transform-origin:  top left

The property takes up to two values: top | right | bottom | left | center.