Usage of CSS perspective property

CSSWeb DevelopmentFront End Technology

To specify the perspective on how 3D elements are viewed, use the CSS perspective property.

You can try to run the following code to work with perspective property:


Live Demo

<!DOCTYPE html>
         .demo1 {
            position: relative;
            width: 150px;
            height: 150px;
            background-color: yellow;
            perspective: 80px;
            margin: 50px;
         .demo2 {
            position: absolute;
            padding: 20px;
            background-color: orange;
            transform-style: preserve-3d;
            transform: rotateX(45deg);
      <div class = "demo1">Demo
         <div class = "demo2">Demo</div>
Updated on 23-Jun-2020 16:00:51