旋转

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <style>
      img {
        width: 170px;
        height: 220px;
      }
      html {
        /* 设置当前网页的视距为800px,人眼距离网页的距离 */
        perspective: 800px;
      }

      body {
        border: 1px red solid;
        background-color: rgb(241, 241, 241);
      }
      .box1 {
        width: 200px;
        height: 200px;
        background-color: #bfa;
        margin: 200px auto;

        transition: 2s;
      }

      body:hover .box1 {
        /* transform: rotateX(120deg);
        transform: rotateY(120deg); */
        transform: rotateZ(1000deg);
      }
    </style>
  </head>
  <body>
    <div class="box1"><img src="/img/tieren.png" /></div>
  </body>
</html>

 单位:

    deg

    turn

    px

backface-visibility:hidden;

属性值:hidden不显示元素背景

    visible显示元素背景

posted @ 2022-03-27 13:35  罗砂  阅读(49)  评论(0)    收藏  举报