Zz_chandler 2023-07-17 18:21 采纳率: 50%
浏览 14
已结题

前端HTML 3d翻转问题

h5 3d转换实现不了
鼠标经过,虽然翻转了但仍是同一个颜色同一面内容。
代码如下,请前端友友帮忙

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>前后翻转</title>
    <style>
        body {
            perspective: 400px;
        }

        .box {
            transform-style: preserve-3d;
            position: relative;
            width: 300px;
            height: 300px;
            margin: 100px auto;
            transition: all 1s;

        }

        .box:hover {
            transform: rotateY(180deg);
        }

        .front,
        .back {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            border-radius: 50%;
            font-size: 30px;
            color: #fff;
            text-align: center;
            line-height: 300px;
        }

        .front {
            background-color: pink;
            z-index: 1;
        }

        .back {
            background-color: purple;
            transform: rotateY(180deg);
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="front">好好学习</div>
        <div class="back">天天向上</div>
    </div>
</body>

</html>

  • 写回答

2条回答 默认 最新

  • i__0o0__ 2023-07-17 18:35
    关注
    
     .front,  .back{
           backface-visibility: hidden;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 7月25日
  • 已采纳回答 7月17日
  • 创建了问题 7月17日