3D旋转tab图

上图

代码

html 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>3D旋转tab图</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        body {
            height: 100vh;
            background: linear-gradient(to top, #29323c, #485563);
        }

        .container {
            width: 500px;
            display: flex;
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-45%, -50%);
            color: #ffffff;
            text-transform: uppercase;
            perspective: 1300px;
        }

        input {
            display: none;
        }

        .labels {
            height: 250px;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }

        .tab {
            width: 100px;
            height: 80px;
            line-height: 80px;
            text-align: center;
            cursor: pointer;
        }

        .tab:nth-child(1) {
            background-color: #00b4db;
        }

        .tab:nth-child(2) {
            background-color: #009bc5;
        }

        .tab:nth-child(3) {
            background-color: #007ba4;
        }

        .content {
            width: 95%;
            height: 230px;
            position: absolute;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
            background-color: red;
        }

        .content h1 {
            font-size: 28px;
        }

        .content p {
            font-size: 14px;
        }

        .content:nth-child(1) {
            background-color: #00b4db;
            transform: rotateX(-270deg) translateY(-115px);
            transform-origin: top center;
        }

        .content:nth-child(2) {
            background-color: #009bc5;
            transform: translateZ(115px);
        }

        .content:nth-child(3) {
            background-color: #007ba4;
            transform: rotateX(-90deg) translateY(115px);
            transform-origin: bottom center;
        }

        .cube {
            position: relative;
            flex: 1;
            transform-style: preserve-3d;
            transition: transform 0.5s ease-in;
        }

        #top:checked ~ .cube {
            transform: rotateX(-90deg);
        }

        #middle:checked ~ .cube {
            transform: rotateX(0deg) translateY(10px);
        }

        #bottom:checked ~ .cube {
            transform: rotateX(90deg);
        }
    </style>
</head>
<body>
<div class="container">
    <input type="radio" name="tabs" id="top" checked/>
    <input type="radio" name="tabs" id="middle"/>
    <input type="radio" name="tabs" id="bottom"/>
    <div class="cube">
        <div class="content">
            <h1>top content</h1>
            <p>this is top content</p>
        </div>
        <div class="content">
            <h1>middle content</h1>
            <p>this is middle content</p>
        </div>
        <div class="content">
            <h1>bottom content</h1>
            <p>this is bottom content</p>
        </div>
    </div>
    <div class="labels">
        <label for="top" class="tab">top</label>
        <label for="middle" class="tab">middle</label>
        <label for="bottom" class="tab">bottom</label>
    </div>
</div>
</body>
</html>
相关推荐
振华OPPO8 小时前
Vue:“onMounted“ is defined but never used no-unused-vars
前端·javascript·css·vue.js·前端框架
J***Q29211 小时前
前端CSS架构模式,BEM与ITCSS
前端·css
qiaochuanbiao12 小时前
宁波教师巧用3D技术,打造互动几何课堂:动态观察正方体组合,让空间想象触手可及
3d·信息可视化·webos·文汇百川
qq_3985865415 小时前
浏览器中内嵌一个浏览器
前端·javascript·css·css3
杀生丸学AI16 小时前
【动态高斯重建】论文集合:从4DGT到OMG4、4DSioMo
人工智能·3d·aigc·三维重建·视觉大模型·动态高斯
众趣科技17 小时前
当消防安全遇见数字孪生:一场防患于未“燃”的科技革命
3d·vr·空间计算
柒儿吖18 小时前
Qt for HarmonyOS 3D图片轮播组件开源鸿蒙开发实战
qt·3d·harmonyos
3DVisionary20 小时前
蓝光3D扫描仪在汽车模具质量控制中的应用:提升金属与注塑模具的尺寸检测效率
3d·金融·蓝光三维扫描·汽车模具·3d尺寸检测·逆向工程/质量控制·注塑与冶金
Jonathan Star21 小时前
基于 **Three.js** 开发的 3D 炮弹发射特效系统
javascript·数码相机·3d
三条猫21 小时前
AI 大模型如何给 CAD 3D 模型“建立语义”?
人工智能·机器学习·3d·ai·大模型·cad