白也诗无敌诗意染千寻 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日

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分