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>
相关推荐
cz追天之路40 分钟前
华为机考 ------ 识别有效的IP地址和掩码并进行分类统计
javascript·华为·typescript·node.js·ecmascript·less·css3
YAY_tyy2 小时前
Turfjs+Three.js:地理数据的三维建模应用
前端·javascript·3d·arcgis·turfjs
da_vinci_x6 小时前
【游戏场景】手绘贴图“接缝”地狱?PS 智能平铺流,3步量产无缝地砖
游戏·3d·prompt·aigc·贴图·技术美术·游戏美术
霍理迪7 小时前
CSS布局方式——定位
前端·css
灯把黑夜烧了一个洞8 小时前
2026年跨年倒计时网页版
javascript·css·html·2026跨年代码·新年代码
gshh__8 小时前
SuperMap Hi-Fi 3D SDK for Unreal 读取矢量面进行多区域地形开挖
3d
铅笔侠_小龙虾8 小时前
html+css 实现键盘
前端·css·html
时间之里9 小时前
【图像处理3D】:相机坐标系之间的变换
图像处理·人工智能·3d
韩曙亮9 小时前
【Web APIs】移动端返回顶部案例 ( 返回顶部按钮 显示 / 隐藏 设置 | 返回顶部操作 )
前端·javascript·css·html·移动端·web apis·返回顶部
GDAL9 小时前
Tailwind CSS 响应式设计实战指南:从零搭建书签篮自适应页面
前端·css·tailwindcss·书签篮