Transform Origin and Perspective
Change the pivot point of transforms with transform-origin and add depth with perspective.
transform-origin Default
By default, transforms happen around the element's center point: 50% 50%. The transform-origin property changes this pivot.
Setting transform-origin
Accepts keywords, percentages, or lengths. Format: x-axis y-axis z-axis.
.spinning-logo {
transform-origin: top right;
}
.page-fold {
transform-origin: left center;
}
.tooltip::after {
transform-origin: 50% 0; /* top center */
}All lessons in this course
- Translate Rotate and Scale
- Skew and Matrix Transforms
- Transform Origin and Perspective
- 3D Transforms: rotateX rotateY translateZ