THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Style perspectiveOrigin Property

Style Object Reference Style Object

Example

Set a 3D element's base placement:

document.getElementById("myDIV").style.perspectiveOrigin = "10px 50%";
Try it Yourself »

Definition and Usage

The perspectiveOrigin property defines where a 3D element is based in the x- and the y-axis. This property allows you to change the bottom position of 3D elements.

When defining the perspectiveOrigin property for an element, it is the CHILD elements that are positioned, NOT the element itself.

Note: This property must be used together with the perspective property, and only affects 3D transformed elements!


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The perspectiveOrigin property is supported in IE10+ and Firefox.

Chrome, Safari, and Opera support an alternative, the WebkitPerspecitveOrigin property.


Syntax

Return the perspectiveOrigin property:

object.style.perspectiveOrigin

Set the perspectiveOrigin property:

object.style.perspectiveOrigin="x-axis y-axis|initial|inherit"

Property Values

Value Description
x-axis Defining where the view is placed at the x-axis

Possible values:

  • left
  • center
  • right
  • length
  • %

Default value: 50%

y-axis Defining where the view is placed at the y-axis

Possible values:

  • top
  • center
  • bottom
  • length
  • %

Default value: 50%

initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

Technical Details

Default Value: 50% 50%
Return Value: A String, representing the perspective-origin property of an element
CSS Version CSS3

Related Pages

JavaScript Style Object: perspective property

CSS reference: perspective-origin property


Style Object Reference Style Object