3D旋转tab图

上图

代码

<!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>

相关推荐

  1. 3D旋转rotatex

    2023-12-08 12:58:01       15 阅读
  2. Vue3炫酷可旋转3D地球

    2023-12-08 12:58:01       44 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-08 12:58:01       17 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-08 12:58:01       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-08 12:58:01       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-08 12:58:01       18 阅读

热门阅读

  1. composer配置国内镜像

    2023-12-08 12:58:01       43 阅读
  2. MAC PHP版本安装问题

    2023-12-08 12:58:01       35 阅读
  3. 华为云安全组规则

    2023-12-08 12:58:01       38 阅读
  4. PHP 反序列化字符串逃逸

    2023-12-08 12:58:01       30 阅读
  5. git merge和git rebase

    2023-12-08 12:58:01       22 阅读
  6. react经验6:使用SVG图片

    2023-12-08 12:58:01       35 阅读
  7. uni-app解决video组件全屏时页面横竖错乱问题

    2023-12-08 12:58:01       59 阅读
  8. 头歌—Hive的安装与配置

    2023-12-08 12:58:01       40 阅读
  9. 解决使用ip来访问MySQL报错的问题

    2023-12-08 12:58:01       38 阅读
  10. Vue学习笔记-缓存路由组件

    2023-12-08 12:58:01       36 阅读
  11. vue的props

    2023-12-08 12:58:01       30 阅读
  12. 基于深度学习的典型目标跟踪算法

    2023-12-08 12:58:01       30 阅读
  13. 力扣面试150题 | 88.合并两个有序数组

    2023-12-08 12:58:01       29 阅读