白也诗无敌诗意染千寻 2022-11-23 19:51 采纳率: 40%
浏览 3
已结题

css写两面翻转遇见的问题


<div class="box">
        <div class="front">你好</div>
        <div class="back">打工人</div>
    </div>
 body {
            transform-style: preserve-3d;
            perspective: 500px;
        }
        
        .box {
            position: relative;
            width: 200px;
            height: 200px;
            margin: 100px auto;
            transition: all 0.5s;
            transform-style: preserve-3d;
        }
        
        .box:hover {
            transform: rotateY(180deg);
        }
        
        .front,
        .back {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            border-radius: 50%;
            text-align: center;
            line-height: 200px;
            color: #fff;
            font-size: 50px;
        }
        
        .front {
            background-color: red;
            z-index: 1;
        }
        
        .back {
            background-color: pink;
            transform: rotateY(180deg);
        }

浏览器调试后不能实现鼠标经过的时候,打工人字样出现,请求懂的人帮忙看看

  • 写回答

2条回答 默认 最新

  • Iam_楠 前端领域新星创作者 2022-11-23 21:13
    关注

    img


    大概就是上面的样子

    
    body {
          transform-style: preserve-3d;
          perspective: 500px;
        }
        .box {
          position: relative;
          width: 200px;
          height: 200px;
          margin: 100px auto;
          transition: all 0.5s;
          transform-style: preserve-3d;
        }
        .box:hover {
          transform: rotateY(180deg);
        }
        .front,
        .back {
          position: absolute;
          top: 0;
          left: 0;
          width: 100%;
          height: 100%;
          border-radius: 50%;
          text-align: center;
          line-height: 200px;
          color: #fff;
          font-size: 50px;
        }
        .front {
          background-color: red;
          z-index: 1;
        }
    
        .front:hover{
          display: none !important;
        }
    
        .back {
          background-color: pink;
          transform: rotateY(180deg);
        }
        .back:hover{
          display: none !important;
        }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 12月16日
  • 已采纳回答 12月8日
  • 创建了问题 11月23日

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!