CSS rotate Property
Change rotation of an element:
Definition and Usage
rotate property allows you to rotate elements.
rotate property defines a value for how much an element is rotated clockwise around z-axis. To rotate an element around x-axis or y-axis or in other ways, this must be defined.
rotate property can be given as one angle, axis name + angle, or three values + angle.
- If an angle is given, the element is rotated clockwise around z-axis.
- If axis name + angle is given, the element is rotated clockwise around that given axis.
- If three values are given + angle, the three values define a vector which the element is rotated around.
To better understand the
view a demo.
Note: An alternative technique to rotate an element is to use CSS
transform property with CSS
rotate() function. The CSS
rotate property, as explained on this webpage, is arguably a simpler and more direct way to scale an element.
|Animatable:||yes. Read about animatable Try it|
The numbers in the table specify the first browser version that fully supports the property.
|axis||Optional. If not set, z-axis is default. Defines axis to rotate element around. Possible values:
|angle||Defines how much an element is rotated. Possible units:
|vector angle||Three numbers define a vector for the element to be rotated around. The numbers are x-, y- and z-coordinates for the vector, respectively. The last value is the angle for how much to rotate. Possible values:
|initial||Sets this property to its default value. Read about initial|
|inherit||Inherits this property from its parent element. Read about inherit|
rotate property is set with vector and angle, the element is rotated around that vector. Here, the vector is [1 1 0] in 2D plane with x- and y-coordinates, and then rotated 60 degrees:
rotate: 1 1 0 60deg;
CSS tutorial: CSS 2D Transforms
CSS tutorial: CSS 3D Transforms
CSS scale property: CSS Scale property
CSS translate property: CSS Translate property