CSS: transform-style

CSS: transform-style

 

 

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    body{
      /* .box .box>div 都开启透视效果 */
      perspective: 500px;
    }
    .box{
      position: relative;
      width: 200px;
      height: 200px;
      margin: 100px auto;
      /* 子元素 .box>div 保持3d空间 */
      transform-style: preserve-3d;
      transform: rotateY(60deg);
    }
    .box div{
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: palegoldenrod;
    }
    .box div:last-child{
      background-color: teal;
      transform: rotateX(60deg);
    }
  </style>
</head>
<body>
  <div class="box">
    <div></div>
    <div></div>
  </div>
</body>
</html>

CSS: transform-style

 

上一篇:css3 跑马灯


下一篇:大爽Python入门教程 7-4 实践演示 控制台版本——简易回合战斗