如何指定 3D 元素的透视视图


使用 CSS 視角屬性指定 3D 元素的視角。

你可以嘗試運行以下代碼來實現

範例

線上範例

<!DOCTYPE html>
<html>
   <head>
      <style>
         .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);
         }
       </style>
   </head>
   <body>
      <h1>Rotation</h1>
      <div class = "demo1">Demo
         <div class = "demo2">Demo
         </div>
      </div>
   </body>
</html>

更新於:2020-06-23

55 個觀看次數

開展你的 事業

通過完成課程獲得認證

開始
广告
© . All rights reserved.