Overview
3D CSS transforms allow you to move, rotate, scale, and skew an element on three planes.
Note
The following are basic examples. Towards the bottom of this page you’ll find a complete list of all applicable properties, where you can find more information on the properties discussed, and sometimes find more involved properties not discussed on this page.
The following 3D transformation methods can be used with the transform property:
- rotateX()
- rotateY()
- rotateZ()
/* rotates the element around its X-axis 120deg */
div {
transform: rotateX(120deg);
}
/* rotates the element around its Y-axis 120deg */
div {
transform: rotateY(120deg);
}
/* rotates the element around its Z-axis 120deg */
div {
transform: rotateZ(120deg);
}
Properties
- CSS – perspective PropertyThe perspective property is used to define how far a 3D-positioned element is away from the user.
- CSS – perspective-origin PropertyThe perspective-origin property defines from which position the user is looking at the 3D-positioned element.
- CSS – transform PropertyThe transform property applies a 2D or 3D transformation to an element, allowing it to be rotated, scaled, moved, skewed, etc.
- CSS – transform-origin PropertyThe transform-origin property allows you to change the position of transformed elements.
- CSS – transform-style PropertyThe transform-style property specifies how nested elements are rendered in 3D space, and must be used together with the transform property.
CSS Notes:
- The “inherit”, “initial” and “unset” keywords can be used with any CSS property to set its value
- In CSS there are many ways to express a color value in a property
We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.