css 两面翻转

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>两面翻转</title>
  <style>
    div{
      width: 200px;
      height: 200px;
    }
    .box{
      position: relative;
      margin: 100px auto;
      /* 让背面的紫色盒子保留立体空间 给父级添加的*/
      transform-style: preserve-3d;
      transition: transform 1s;
    }
    .box:hover{
      transform: rotateY(180deg);
    }
    .front,
    .back{
      position: absolute;
      text-align: center;
      line-height: 200px;
      border-radius: 50%;
    }
    .front{
      background-color: pink;
      z-index: 1;
    }
    .back{
      background-color: purple;
      transform: rotateY(180deg);
    }
  </style>
</head>
<body>
  <div class="box">
    <div class="front">xxx</div>
    <div class="back">yyyy</div>
  </div>
</body>
</html>
上一篇:行内元素与块元素的水平垂直居中


下一篇:Oracle——图形工具PLSqlDeveloper安装