CSS rotate Property

❮ Previous Reference Next ❯

Example

div {
  display: inline-block;
  margin: 1em;
  min-width: 6.5em;
  line-height: 6.5em;
  text-align: center;
  transition: 1s ease-in-out;
  border: 4px dotted #1A73E8;
}

#box1:hover {
  rotate: 90deg;
}

#box2:hover {
  rotate: y 180deg;
}

#box3:hover {
  rotate: 1 2 1 360deg;
}





Hello World!

Meaning:

The rotate CSS property specify rotation transforms individually and independently of the transform property.

This maps better to typical user interface usage, and saves having to remember the exact order of transform functions to specify in the transform property.

Default value:none
Inherited:No
Animatable:No
Version:CSS3
JavaScript syntax:
object.style.rotate="none|angle value|x, y, or z axis name plus angle value|vector plus angle value|initial|inherit|revert|revert-layer|unset";



Standard Syntax

rotate: none|angle value|x, y, or z axis name plus angle value|vector plus angle value|initial|inherit|revert|revert-layer|unset;



Browser Support




Status







Property Values

The following table describes the values of this property:

Value Description
none Specifies that no rotation should be applied.
angle value An angle specifying the angle to rotate the affected element through, around the Z axis. Equivalent to a rotate() (2D rotation) function.
x, y, or z axis name plus angle value The name of the axis you want to rotate the affected element around ("x", "y", or "z"), plus an angle specifying the angle to rotate the element through. Equivalent to a rotateX()/rotateY()/rotateZ() (3D rotation) function.
vector plus angle value Three numbers representing an origin-centered vector that defines a line around which you want to rotate the element, plus an angle specifying the angle to rotate the element through. Equivalent to a rotate3d() (3D rotation) function.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element animation-delay property.
revert Reverts the cascaded value of the property from its current value to the value the property
revert-layer Rollback styles to the ones specified in previous cascade layers.
unset Resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not.



Default CSS Property Values

selectors {
  rotate: none;
}
❮ Previous Reference Next ❯