6.3 (案例) backface

backface.png
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>backface</title>
    <style type="text/css">


/*
backface-visibility:
visible:默认值,旋转的时候背景可见。
hidden:旋转的时候背景不可见。*/
    *{
        padding: 0;
        margin: 0;
    }
    section{
        -webkit-perspective:800px;
    }
    .box{
        width: 400px;
        height: 400px;
        /*overflow: hidden;  只会出来一张*/
        -webkit-transform-style: preserve-3d;
        /*
        子元素保持3D位置,让其 可以 空间内旋转,位移
        */
        margin: 0 auto;
        position: relative;
        transition: 1.5s all ease;
    }
    img{
        position: absolute;
        width: 400px;
        height: 400px;
        border-radius: 50%;
    }
    img:nth-child(1){
        /*transform: rotateY(180deg);*/
    }
    img:nth-child(2){
        transform: rotateY(180deg) translateZ(50px);
    }
    div:hover{
        transform:rotateY(180deg);
    }
    </style>
</head>
<body>
    <section>
        <div class="box">
            ![](1.png)
            ![](10.png)
        </div>
    </section>
</body>
</html>
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容