首頁  >  文章  >  web前端  >  指定如何在 3D 空間中渲染嵌套元素

指定如何在 3D 空間中渲染嵌套元素

WBOY
WBOY轉載
2023-09-02 12:57:02653瀏覽

指定如何在 3D 空间中渲染嵌套元素

要指定如何在 3D 空間中呈現巢狀元素,請使用 CSS 中的 transform-style 屬性。

您可以嘗試執行以下程式碼來實作transform-style屬性:

範例

#現場示範

<!DOCTYPE html>
<html>
   <head>
      <style>
         .demo1 {
            width: 300px;
            height: 300px;
            background-color: yellow;
         }
         .demo2 {
            width: 200px;
            height: 200px;
            background-color: orange;
         }
         .demo3 {
            width: 100px;
            height: 100px;
            background-color: blue;
            transform: rotate(10deg);
            transform-origin: 30% 40%;
            transform-style: preserve-3d;
         }
      </style>
   </head>

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

以上是指定如何在 3D 空間中渲染嵌套元素的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:tutorialspoint.com。如有侵權,請聯絡admin@php.cn刪除