Latest web development tutorials

HTML DOM Style perspective property

Style Object Reference Style Objects

Examples

The element being viewed Perspective locations:

document.getElementById("myDIV").style.perspective="50px";

try it"

Definition and Usage

From the perspective attribute definition 3D elements from view, in pixels. This property allows you to change the perspective of 3D elements are viewed.

When an element is defined perspective attributes, its children will get the perspective effect, rather than the element itself.

Note: perspective property affects only 3D conversion element!

Note: Please This property perspectiveOrigin property used together, so you can change the position of the bottom of the 3D elements.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

IE10 + and Firefox support perspective properties.

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


grammar

Returns perspective attributes:

object .style.perspective

Setting perspective attributes:

object .style.perspective="length|none"

Property Value

描述
length 元素距离视图的距离,以像素计。
none 默认值。与 0 相同。不设置透视。
initial 设置该属性为它的默认值。请参阅 initial
inherit 从父元素继承该属性。请参阅 inherit

technical details

Defaults: none
return value: String representing the perspective attribute element.
CSS version CSS3


related articles

JavaScript Style Object: perspectiveOrigin property

CSS Reference: Perspective Properties


Style Object Reference Style Objects