Computer >> คอมพิวเตอร์ >  >> การเขียนโปรแกรม >> CSS

คุณสมบัติที่มาของเปอร์สเปคทีฟ CSS


ใช้คุณสมบัติต้นทางเปอร์สเปคทีฟเพื่อระบุตำแหน่งด้านล่างขององค์ประกอบ 3 มิติ

คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อใช้คุณสมบัติเปอร์สเปคทีฟ-ออริจิน:

ตัวอย่าง

<!DOCTYPE html>
<html>
   <head>
      <style>
        .demo1 {
            position: relative;
            width: 150px;
            height: 150px;
            background-color: yellow;
            perspective: 80px;
            margin: 50px;
            perspective-origin: left;
         }
         .demo2 {
            position: absolute;
            padding: 20px;
            background-color: orange;
            transform-style: preserve-3d;
            transform: rotateX(45deg);
         }
      </style>
   </head>

   <body>
      <h1>Rotation</h1>
      <div class = "demo1">Demo
         <div class = "demo2">Demo</div>
      </div>
   </body>
</html>