{"id":356179,"date":"2021-11-08T11:00:53","date_gmt":"2021-11-08T19:00:53","guid":{"rendered":"https:\/\/css-tricks.com\/?page_id=356179"},"modified":"2021-11-10T16:23:49","modified_gmt":"2021-11-11T00:23:49","slug":"rotate","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/r\/rotate\/","title":{"rendered":"rotate"},"content":{"rendered":"\n

The rotate<\/code> property in CSS turns an element around one or more axes. Think of it like poking one or more pins into an element and spinning the element around those points in clockwise and counter-clockwise directions measured in degree, gradian, radian, and turn values.<\/p>\n\n\n\n

.element {\n  rotate: 45deg;\n}<\/code><\/pre>\n\n\n\n\n\n\n\n

While CSS already has another way to rotate elements using the rotate()<\/code><\/a> function in the transform<\/code> property, like this:<\/p>\n\n\n\n

.element {\n  transform: rotate(45deg);\n}<\/code><\/pre>\n\n\n\n

\u2026the CSS rotate<\/code> property does it independently of the transform<\/code><\/a> property altogether, plus the added benefit of being able to rotate along the Z-axis, something not currently possible with transform: rotate()<\/code>.<\/p>\n\n\n

Syntax<\/h3>\n\n\n
rotate: none | <angle> | [ x | y | z | <number>{3} ] && <angle>;<\/code><\/pre>\n\n\n\n

The angle values are expressed in degrees, gradians, radians, or turns.<\/p>\n\n\n\n

\/* Keyword values *\/\nrotate: none;\n\n\/* Angle values *\/\nrotate: 45deg;\nrotate: 0.35turn;\nrotate: 1.27rad;\nrotate: -50grad;\n\n\/* x, y, or z-axis name plus angle *\/\nrotate: x 45deg;\nrotate: y 0.35turn;\nrotate: z 1.27rad;\n\n\/* Vector plus angle values *\/\nrotate: 1 0.5 1 45deg;\n\n\/* Global values *\/\nrotate: inherit;\nrotate: initial;\nrotate: revert;\nrotate: unset;<\/code><\/pre>\n\n\n\n