YouTip LogoYouTip

Prop Style Perspective

# Style perspective Property [![Image 8: Style Object Reference](#) Style Object](#) ## Example Set the perspective from which an element is viewed: ```javascript document.getElementById("myDIV").style.perspective="50px"; [Try it Yourself Β»](#) * * * ## Definition and Usage The perspective property defines the distance from the view to the 3D element, in pixels. This property allows you to change the perspective from which 3D elements are viewed. When the perspective property is defined for an element, its child elements will get the perspective effect, not the element itself. **Note:** The perspective property only affects 3D transformed elements! **Tip:** Use this property together with the (#) property, so that you can change the bottom position of 3D elements. * * * ## Browser Support ![Image 9: Internet Explorer](#)![Image 10: Firefox](#)![Image 11: Opera](#)![Image 12: Google Chrome](#)![Image 13: Safari](#) IE10+ and Firefox support the perspective property. Chrome, Safari, and Opera support an alternative property for this property, which is the WebkitPerspective property. * * * ## Syntax Get the perspective property: ```javascript _object_.style.perspective Set the perspective property: ```javascript _object_.style.perspective="_length_|none" ## Property Values | Value | Description | | --- | --- | | _length_ | The distance from the element to the view, in pixels. | | none | Default value. Same as 0. No perspective is set. | | initial | Sets this property to its default value. See (#). | | inherit | Inherits this property from its parent element. See (#). | ## Technical Details | Default Value: | none | | --- | | Return Value: | A string, representing the perspective property of the element. | | CSS Version | CSS3 | * * * ## Related Articles JavaScript Style Object: (#) CSS Reference: (#) * * Style Object](#)
← Prop Style PerspectiveoriginProp Style Overflowy β†’