CSS rotate() Function
Example
Use rotate() to rotate several <div> elements:
#myDiv1 {
transform: rotate(25deg);
}
#myDiv2 {
transform: rotate(45deg);
}
#myDiv3 {
transform: rotate(-45deg);
}
Try it Yourself »
More "Try it Yourself" examples below.
Definition and Usage
The CSS rotate()
function defines a 2D
rotation of
an element.
The rotate()
function is used within the
transform property.
Version: | CSS Transforms Module Level 1 |
---|
Browser Support
The numbers in the table specify the first browser version that fully supports the function.
Function | |||||
---|---|---|---|---|---|
rotate() | 1 | 12 | 3.5 | 3.1 | 10.5 |
CSS Syntax
rotate(angle)
Value | Description |
---|---|
angle | Required. Specifies the angle of rotation. Possible units:
|
More Examples
Example
Use rotate() to rotate images:
#img1 {
transform: rotate(90deg);
}
#img2 {
transform: rotate(45deg);
}
#img3 {
transform: rotate(-45deg);
}
Try it Yourself »
Related Pages
CSS reference: CSS transform property.
CSS reference: CSS rotate property.
CSS reference: CSS rotate3d() function.
CSS reference: CSS rotateX() function.
CSS reference: CSS rotateY() function.
CSS reference: CSS rotateZ() function.
CSS tutorial: CSS 2D transforms.