Blogger Information
Blog 37
fans 0
comment 1
visits 28436
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
css3 3D立方体
kong
Original
1117 people have browsed it


微信图片_20200709235154.png

<!DOCTYPE html>

<html lang="en">


<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>立方体</title>

</head>

<style>
    * {
        padding: 0;
        margin: 0;
    }
    
    #wrap {
        width: 400px;
        height: 400px;
        border: 1px solid #000;
        position: absolute;
        left: 50%;
        top: 50%;
        margin-left: -200px;
        margin-top: -200px;
        perspective: 200px;
        /* transform-style: preserve-3d; */
    }
    
    #wrap .box {
        width: 100px;
        height: 100px;
        position: absolute;
        left: 50%;
        top: 50%;
        margin-left: -50px;
        margin-top: -50px;
        transition: all 2s;
        transform-origin: center center -50px;
        transform-style: preserve-3d;
    }
    
    #wrap .box div {
        position: absolute;
        width: 100px;
        height: 100px;
        text-align: center;
        background: rgba(0, 0, 0, .3);
        font: 50px/100px "微软雅黑";
    }
    
    #wrap .box div:nth-child(1) {
        z-index: 1;
    }
    
    #wrap .box div:nth-child(2) {
        transform: translateZ(-100px) rotateX(180deg);
    }
    
    #wrap .box div:nth-child(3) {
        transform-origin: right;
        transform: rotateY(-90deg);
        left: -100px;
    }
    
    #wrap .box div:nth-child(4) {
        transform-origin: left;
        transform: rotateY(90deg);
        right: -100px;
    }
    
    #wrap .box div:nth-child(5) {
        transform-origin: bottom;
        transform: rotateX(90deg);
        top: -100px;
    }
    
    #wrap .box div:nth-child(6) {
        transform-origin: top;
        transform: rotateX(-90deg);
        bottom: -100px;
    }
    
    #wrap:hover .box {
        transform: rotateX(360deg);
    }
</style>


<body>

    <div id="wrap">

        <div class="box">

            <div>前</div>

            <div>后</div>

            <div>左</div>

            <div>右</div>

            <div>上</div>

            <div>下</div>

        </div>

    </div>

</body>


</html>


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post