<h1>The perspective Property</h1>

<h2>perspective: 100px:</h2>
<div id="div1">DIV1
  <div id="div2">DIV2</div>
</div>

<h2>perspective: none:</h2>
<div id="div3">DIV3
  <div id="div4">DIV4</div>
</div>



<!-- BLOG - https://blog.rahulism.co -->

#div1 {
  position: relative;
  height: 150px;
  width: 150px;
  margin-left: 60px;
  border: 3px solid yellow;
  perspective: 100px;
}

#div2, #div4 {
  padding: 50px;
  position: absolute;
  border: 1px solid black;
  background-color: red;
  background: rgba(255, 0, 0, 0.2);; 
  transform-style: preserve-3d;
  transform: rotateX(45deg);
}

#div3 {
  position: relative;
  height: 150px;
  width: 150px;
  margin-left: 60px;
  border: 3px solid yellow;
  perspective: none;
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.