CSS propertyTransforms

perspective-origin

Sets the point from which the viewer looks at a 3D scene.

Initial value
50% 50%
Inherited
No
Animatable
yes, as a length or percentage
Applies to
transformable elements (the effect applies to their children)
JavaScript
element.style.perspectiveOrigin = "left top"
On this page

Example

#
CSS
.stairs {
  perspective: 500px;
  perspective-origin: 50% -50%;
}
Preview

Definition and usage

#

The perspective-origin property moves the perspective vanishing point. By default the viewer looks exactly at the centre of the element. Moving the point makes the scene look as if viewed from above, from the side, or from below.

It works together with perspective and, like it, is set on the parent while affecting the appearance of children transformed in 3D.

It accepts keywords, percentages, and lengths, just like transform-origin.

Syntax

#
Syntax
perspective-origin: <x> <y>?;

Values

#
  • center

    The viewer looks at the centre of the scene.
  • top

    A view from above.
  • bottom

    A view from below.
  • left

    A view from the left side.

Values in practice

#

center

The viewer looks at the centre of the scene.
.scene { perspective-origin: center; }

top

A view from above.
.scene { perspective-origin: top; }

bottom

A view from below.
.scene { perspective-origin: bottom; }

left

A view from the left side.
.scene { perspective-origin: left; }

Browser support

#

Widely available

Works in all modern browsers, phones included. You can use it without worry.

  • Chrome
  • Edge
  • Firefox
  • Safari

Good practices

#
  • Without perspective set, this property changes nothing.
  • A slight shift of the vanishing point adds realism to 3D scenes, because we rarely look at something perfectly head-on.

Related entries

#

Spotted a mistake or missing an example? Write to us.