Skip to content
Related Articles

Related Articles

Improve Article

HTML | DOM Style perspective Property

  • Last Updated : 20 Feb, 2019

The Style perspective property in HTML DOM is used to determine how far an element is placed from the Z plane. It provides the 3D view of an element.


  • It returns the perspective property.
  • It sets the perspective property. = "none|length|initial|inherit"

Property Values:

  • none: It is the default value. It sets the perspective to zero or perspective not set.
  • length: It sets the distance where the element is placed from the view.
  • initial: It sets the element to its initial position.
  • inherit: The element inherits its property from parent element.

Example: This example displays the DOM style perspective property.

<!DOCTYPE html>
        #circle {
            height: 400px;
            width: 400px;
            margin-left: 50px;
            background-color: #555;
            border-radius: 50%;
        #container {
            padding: 50px;
            margin: 0 60px;
            border: 1px solid black;
            background-color: white;
            transform: rotateX(15deg);
        h1, h2 {
    <div id="circle">
        <button onclick="myGeeks()"
            Click Here! 
        <div id="container">
                A computer science portal for geeks
    <!-- Script to display perspective property -->
        function myGeeks() {
                    = "100px";

Before Click on the button:

After Click on the button:

Supported Browsers: The browser supported by DOM Style perspective Property are listed below:

  • Google Chrome 36.0
  • Internet Explorer 10.0
  • Firefox 16.0
  • Safari 6.1
  • Opera 23.0

Attention reader! Don’t stop learning now. Get hold of all the important Comcompetitivepetitve Programming concepts with the Web Design for Beginners | HTML  course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :