【HTML】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>Document</title>
    <style>
        html{overflow: hidden;}
        .box1 { width: 300px; height: 300px; border: 1px black solid; margin: 30px auto; perspective: 100px;}
        .box2 { width: 100px; height: 100px; background: red; margin: 100px; transition: 1s; 
            /* transform: rotateX(0); */
            transform: rotateY(0);
        }

        .box1:hover .box2 {
            /* transform: rotateX(180deg); */
            transform: rotateY(180deg);
        }
    </style>
</head>
<body>
    <div class="box1">
        <div class="box2"></div>
    </div>
</body>
</html>

效果:

原文地址:https://www.cnblogs.com/144823836yj/p/15333835.html