Elective Course

Course recommendation:

Comment: When the property is defined, its child elements will get the perspective effect instead of the element itself. Style perspective property

Definition and Usage Comment: When the property is defined, its child elements will get the perspective effect instead of the element itself. property, it defines the distance of the 3D element from the view in pixels. This property allows you to change the perspective of viewing 3D elements.

When defining theComment: When the property is defined, its child elements will get the perspective effect instead of the element itself. perspective

The property only affects 3D transformation elements.Tip: perspective-origin property Use this property together to change the bottom position of 3D elements.

See also:

JavaScript Style Object:perspectiveOrigin property

CSS Reference Manual:perspective property

Example

Set the perspective of the viewing element:

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

Try it yourself

Syntax

Return perspective property:

object.style.perspective

Set perspective property:

object.style.perspective = "length|none"

Attribute value

Value Description
length The distance of the element from the view in pixels.
none Default value. Same as 0. No perspective.
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical details

Default value: None
Return value: A string representing the element's perspective property.
CSS version: CSS3

Browser support

Table numbers indicate the first browser version to fully support this attribute.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
36.0 10.0 16.0 6.1 23.0