Latest web development tutorials

HTML DOM Style perspectiveOrigin property

Style Object Reference Style Objects

Examples

3D elements set point position:

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

try it"

Definition and Usage

perspectiveOrigin attribute definition 3D elements based on the X-axis and Y-axis. This property allows you to change the position of the bottom of the 3D elements.

When an element is defined perspectiveOrigin attributes, child elements get their perspective effect, rather than the element itself.

Note: Please This property perspective attribute, but only affects the 3D conversion element!


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

IE10 + and Firefox support perspectiveOrigin property.

Chrome, Safari and Opera support another alternative of the property attribute that WebkitPerspecitveOrigin property.


grammar

Back perspectiveOrigin properties:

object .style.perspectiveOrigin

Setting perspectiveOrigin properties:

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

Property Value

描述
x-axis 定义该视图在 x 轴上的位置。

可能的值:

  • left
  • center
  • right
  • length
  • %

默认值:50%

y-axis 定义该视图在 y 轴上的位置。

可能的值:

  • top
  • center
  • bottom
  • length
  • %

默认值:50%

initial 设置该属性为它的默认值。请参阅 initial
inherit 从父元素继承该属性。请参阅 inherit

technical details

Defaults: 50% 50%
return value: String representing perspective-origin property element.
CSS version CSS3


related articles

JavaScript Style Object: Perspective Properties

CSS Reference: Perspective-Origin attribute


Style Object Reference Style Objects