The CSS perspective-origin: property defines the exact point from which the viewer seems to look at the 3D scene. When using perspective: (either on an element or on its parent container),perspective-origin: controls the βeye positionβ β shifting the 3D depth left/right/up/down.
Note
β Requires perspective: to be active
β Accepts keywords or specific lengths/percentages
π¦ Syntax
perspective-origin syntax
perspective-origin: <x-axis> <y-axis>;
/* Common values */
perspective-origin: center center;
perspective-origin: left top;
perspective-origin: 50% 100%;
perspective-origin: 200px 300px;| Axis | Controls |
|---|---|
| X-axis | Left / center / right (or any px/%) |
| Y-axis | Top / center / bottom (or any px/%) |
π¨ 1. Default Setting
Default
perspective-origin: 50% 50%; /* center center */Viewer is centered horizontally and vertically.
π¨ 2. Move Perspective to the Left
Perspective from left
.scene {
perspective: 800px;
perspective-origin: left center;
}Viewer looks from the left β scene bends more dramatically on the right side.
π¨ 3. Move Perspective to the Top
Top perspective
.scene {
perspective: 800px;
perspective-origin: center top;
}Viewer looks from above β objects appear to tilt downward.
π¨ 4. Strong Angle from Bottom-Right
Bottom right
.scene {
perspective: 700px;
perspective-origin: right bottom;
}Viewer is at the bottom-right corner β creates diagonal depth distortion.
π¨ 5. Custom Lengths
Custom px values
.scene {
perspective: 700px;
perspective-origin: 200px 400px;
}Absolute positioning of the viewer for precise 3D control.
π¨ 6. Using perspective-origin on Parent for Children
The recommended way is to apply perspective and perspective-originto the containing element so that all 3D children share the same viewpoint.
Parent perspective
.scene {
perspective: 600px;
perspective-origin: 75% 30%;
}
.card {
rotateY: 40deg;
}π¨ 7. 3D Card Flip with Custom Perspective Origin
3D card flip
.scene {
perspective: 900px;
perspective-origin: left center;
}
.card {
transform-style: preserve-3d;
transition: rotate 0.6s;
rotateY: 0deg;
}
.card:hover {
rotateY: 180deg;
}The flip appears to tilt from the left due to perspective-origin: left.
π perspective-origin vs transform-origin
| Property | Controls | Example |
|---|---|---|
| perspective-origin | Viewer position | Where you are looking from |
| transform-origin | Rotation/scaling pivot | Where the element spins or scales from |
Note
π§ͺ Real-World Use Cases
1οΈβ£ 3D Tilt Hover Effects
Hover tilt
.scene {
perspective: 800px;
perspective-origin: center top;
}
.card:hover {
rotateX: 20deg;
}2οΈβ£ Hero Sections With 3D Text
3D title
.hero {
perspective: 1000px;
perspective-origin: right center;
}
.hero h1 {
rotateY: -25deg;
}3οΈβ£ Carousel / 3D Gallery
carousel
.carousel {
perspective: 1200px;
perspective-origin: 50% 20%;
}β οΈ Common Mistakes
- β Using perspective-origin without perspective
- β Expecting it to affect 2D transforms
- β Applying to inline elements (use block/inline-block)
- β Forgetting transform-style: preserve-3d on children
Note
π₯ Summary
perspective-origin: gives precise control over where the 3D viewer stands. It allows you to shape the depth, angle, and realism of any 3D CSS transformation.
- perspective-origin = viewer position
- Works only with perspective
- Essential for 3D UI effects