css折扇效果

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      .box {
        width: 500px;
        height: 500px;
        border-bottom: black 1px solid;
        margin: 0 auto;
        position: relative;
      }
      .box div {
        width: 100px;
        height: 300px;
        position: absolute;
        transition: 2s;
        left: 200px;
        transform-origin: center bottom;
        bottom: 50px;
        opacity: 0;
      }
      .box:hover div {
        opacity: 1;
      }

      .box .box1 {
        background: red;
        opacity: 1;
      }
      .box2 {
        background: orange;
      }
      .box3 {
        background: yellow;
      }
      .box4 {
        background: green;
      }
      .box5 {
        background: blue;
      }
      .box6 {
        background: skyblue;
      }
      .box7 {
        background: purple;
      }
      .box8 {
        background: orange;
      }
      .box9 {
        background: yellow;
      }
      .box10 {
        background: green;
      }
      .box11 {
        background: blue;
      }
      .box12 {
        background: skyblue;
      }
      .box13 {
        background: purple;
      }
      .box :hover .box1 {
        transform: rotate(0);
      }
      .box:hover .box7 {
        transform: rotate(-90deg);
      }
      .box:hover .box6 {
        transform: rotate(-75deg);
      }
      .box:hover .box5 {
        transform: rotate(-60deg);
      }
      .box:hover .box4 {
        transform: rotate(-45deg);
      }

      .box:hover .box3 {
        transform: rotate(-30deg);
      }
      .box:hover .box2 {
        transform: rotate(-15deg);
      }
      .box:hover .box8 {
        transform: rotate(15deg);
      }
      .box:hover .box9 {
        transform: rotate(30deg);
      }
      .box:hover .box10 {
        transform: rotate(45deg);
      }
      .box:hover .box11 {
        transform: rotate(60deg);
      }
      .box:hover .box12 {
        transform: rotate(75deg);
      }
      .box:hover .box13 {
        transform: rotate(90deg);
      }
    </style>
  </head>
  <body>
    <div class="box">
      <div class="box1">1</div>
      <div class="box7">7</div>
      <div class="box6">6</div>
      <div class="box5">5</div>
      <div class="box4">4</div>
      <div class="box3">3</div>
      <div class="box2">2</div>
      <div class="box8">2</div>
      <div class="box9">3</div>
      <div class="box10">4</div>
      <div class="box11">5</div>
      <div class="box12">6</div>
      <div class="box13">7</div>
    </div>
  </body>
</html>

我们做折扇效果时应该注意结构的顺序,不然可能会导致折扇中的数字被遮盖。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值