Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Transforms, Transitions and Animations

The perspective-origin property

Reference for the CSS perspective-origin property: move the vanishing point of a 3D scene, with syntax, values, live examples and browser support.

The perspective-origin property sets the vanishing point of a 3D scene: the spot that the viewer is looking straight at. It only matters on an element that also has the perspective property, and it affects how that element's children look when they are transformed in 3D.

By default the vanishing point is the center of the element (50% 50%). Moving it left, right, up or down changes the angle you appear to view the scene from, without moving any of the content.

CSS
.stage {
  perspective: 400px;
  perspective-origin: 20% 50%;
}

Try it

Three vanishing points

All three cards have the same rotateY(50deg) transform. Only the vanishing point of the surrounding stage differs, so the same rotation looks different in each box.

Syntax

CSS
perspective-origin: <position>

/* examples */
perspective-origin: center;
perspective-origin: left top;
perspective-origin: 25% 75%;
perspective-origin: 10rem 40px;
perspective-origin: right 20px bottom 10px;
  • Initial value: 50% 50%
  • Applies to: transformable elements
  • Inherited: no
  • Percentages: refer to the size of the element's reference box (its border box by default)
  • Animatable: yes, as a length or percentage
  • Computed value: the horizontal and vertical offsets, with lengths made absolute

Values

Value Description
left, center, right Keyword for the horizontal position.
top, center, bottom Keyword for the vertical position.
<length> An offset from the top-left corner, such as 40px or 10rem. Negative values are allowed.
<percentage> A share of the box's width (horizontal) or height (vertical).
Edge offsets The four-value form such as right 20px bottom 10px measures offsets from the named edges.

With one value, the other axis defaults to center. With two values, the first is horizontal and the second vertical, unless you use keywords that name the axis (top left also works).

Usage notes

  • It needs perspective. perspective-origin is set on the same element as perspective, the parent of the transformed children. On its own it does nothing.
  • Not the same as transform-origin. transform-origin is the pivot point of one element's own transform. perspective-origin is where the viewer's eye sits for all the children. The perspective() transform function also uses transform-origin, not perspective-origin.
  • Only the parent matters. Children cannot override the vanishing point; it belongs to the element that creates the perspective.
  • Preserving 3D. If the children contain further 3D-transformed elements, set transform-style: preserve-3d on the children so the deeper levels share the same scene.
  • Use it for parallax and tilt effects. Animating perspective-origin from a pointer position makes a scene seem to follow the mouse. Keep the motion small and respect prefers-reduced-motion.
  • Keep it subtle. Large offsets on a short perspective distort objects strongly. If a scene looks stretched, increase the perspective value.

Browser support

Supported in all current browsers; older Safari versions needed the -webkit- prefix, which modern code no longer needs.