rotateY() CSS Function
Description
The rotateY() CSS function is part of the 3D transform functions in CSS, used to rotate an element around its vertical Y-axis. When applied, the element appears to spin left or right in 3D space, giving the illusion of depth on the screen. Unlike rotateX(), which rotates along the horizontal axis, rotateY() rotates the element from side to side, making one side appear closer or farther depending on the rotation angle.
This function is often used together with the transform property to animate or adjust elements dynamically. For instance, combining rotateY() with transition allows smooth flipping effects on elements like div or img tags. It is also commonly paired with perspective on a parent element to create a more realistic 3D appearance.
A simple example:
.card {
width: 200px;
height: 300px;
background-color: #f0f0f0;
transform: rotateY(180deg);
transition: transform 0.6s;
}
.card:hover {
transform: rotateY(0deg);
}
In this example, a card element initially shows its back side and rotates to reveal the front side when hovered. Using rotateY() is particularly effective for interactive UI components like flipping cards, 3D menus, or image galleries, giving a modern, engaging feel.
Syntax
transform: rotateY(<angle>);
Values
- <angle>A positive value rotates the element clockwise, a negative value rotates the element counter clockwise.
Example
Browser Support
The following information will show you the current browser support for the CSS rotateY() function. Hover over a browser icon to see the version that first introduced support for this CSS function.
This function is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 31st December 2025
