Style perspectiveOrigin Property
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
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
perspectiveOrigin | 36.0 | 10.0 | 16.0 | 6.1 | 23.0 |
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:
Default value: 50% |
y-axis | Defining where the view is placed at the y-axis Possible values:
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