纯css实现三维盒子旋转效果

代码语言:html

所属分类:三维

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">

    <style>
        /* basic style */
        html,
        body {
            position: relative;
            overflow: hidden;
        }

        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background: radial-gradient(circle at center, #222, #000);
            transform-style: preserve-3d;
            -webkit-transform-style: preserve-3d;
        }

        .flex {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 80px;
            height: 80px;
            margin: 0 -80px 0 0;
        }

        /* cube */
        .cube {
            position: relative;
            width: 1px;
            height: 1px;
            margin: 0 80px 0 0;
            transform-style: preserve-3d;
        }

        .wall {
            width: 80px;
            height: 80px;
            position: absolute;
            left: calc(-80px / 2);
            top: calc(-80px / 2);
            text-align: center;
            line-height: 100px;
            border: solid 1px #fff.........完整代码请登录后点击上方下载按钮下载查看

网友评论0