Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Style perspectiveOrigin Property

Style perspectiveOrigin Property

Style Object Reference The Style object

Example

Set the base position of a 3D element:

document.getElementById("myDIV").style.perspectiveOrigin="10px 50%";

Try it »


Definition and Usage

The perspectiveOrigin property defines the position of a 3D element based on the X and Y axes. This property allows you to change the bottom position of a 3D element.

When the perspectiveOrigin property is defined for an element, its child elements gain a perspective effect, not the element itself.

**Note:** Use this property together with the perspective property, and it only affects 3D transformed elements!


Browser support

Internet Explorer Firefox Opera Google Chrome Safari

IE10+ and Firefox support the perspectiveOrigin property.

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


Syntax

Return the perspectiveOrigin property:

object

.style.perspectiveOrigin

Set the perspectiveOrigin property:

object

.style.perspectiveOrigin="

x-axis y-axis

|initial|inherit"

Attribute values

Value Description
x-axis Defines the position of the view on the x-axis.

Possible values:

  • left
  • center
  • right
  • length
  • %
  • Default value: 50%

    | | *y-axis* | Defines the position of the view on the y-axis.

    Possible values:

    Default value: 50%

    | | initial | Sets the property to its default value. See [*initial*](/cssref/css-initial.html). | | inherit | Inherits the property from the parent element. See [*inherit*](/cssref/css-inherit.html). |

    Technical Details

    Default value: 50% 50%
    Return Value: A string representing the element's perspective-origin property.
    CSS version CSS3

    Related Articles

    JavaScript Style object:perspective property

    CSS Reference Manual:perspective-origin property


    Style Object Reference The Style object