3D悬停相册

先上图

代码:

html 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>3D悬停相册</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body{
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: #1a252c;
        }
        .container{
            position: relative;
            display: flex;
            justify-content: center;
            align-items: center;
            transform-style: preserve-3d;
        }
        .container .box{
            width: 240px;
            height: 180px;
            margin: 0 8px;
            position: relative;
            transition: 0.5s;
            cursor: pointer;
            -webkit-box-reflect: below 1px linear-gradient(transparent, #0002);
        }
        .container .box img{
            width: 100%;
            height: 100%;
            border-radius: 5px;
            object-fit: cover;
        }
        .container:hover > :not(:hover){
            margin: 0 -20px;
            filter: drop-shadow(0 0 25px #000) drop-shadow(0 0 45px #000);
            transform: perspective(500px) rotateY(45deg) scale(0.95);
        }
        .container .box:hover ~ .box{
            transform: perspective(500px) rotateY(-45deg) scale(0.95);
        }
        .container .box:hover{
            transform: perspective(500px) rotateY(0) scale(1.2);
            z-index: 1000;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="box"><img src="https://img0.baidu.com/it/u=1566675905,2132741662&fm=253&fmt=auto&app=120&f=JPEG?w=1280&h=800" alt=""></div>
    <div class="box"><img src="https://img0.baidu.com/it/u=2214529956,2196429262&fm=253&fmt=auto&app=120&f=JPEG?w=1280&h=800" alt=""></div>
    <div class="box"><img src="https://img2.baidu.com/it/u=1534042975,2880231987&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=751" alt=""></div>
    <div class="box"><img src="https://img0.baidu.com/it/u=1189064591,1474666180&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=666" alt=""></div>
    <div class="box"><img src="https://img0.baidu.com/it/u=1566675905,2132741662&fm=253&fmt=auto&app=120&f=JPEG?w=1280&h=800" alt=""></div>
</div>
</body>
</html>
相关推荐
HexCIer6 小时前
面向未来的原子化 CSS:UnoCSS 核心架构分析与 Tailwind CSS 现状
前端·css·vite
用户0595401744613 小时前
把大模型记忆回归测试从手工检查换成 Playwright+VCR,误判率从 40% 降到 0
前端·css
Quz13 小时前
QML 文字入场动画:逐字弹出、逐字飞入、3D 飞入
qt·3d·动画·qml
breeze jiang14 小时前
从零搭建浏览器端 AI 原型:React、WebGPU 与 Tailwind CSS 的一次实践
css·人工智能·react.js
不好听6131 天前
Tailwind CSS 原子化 CSS 完全入门:为什么现代前端开发都在用?
前端·css
奇牙coding1 天前
gpt-5.6-sol 接入指南:reasoning_effort 参数配置、推理链验证与常见报错排查
前端·css·gpt·ai
蓝速科技1 天前
蓝速科技 3D 全息舱与 AI 数字人酒店降本增效实战
人工智能·科技·3d
在下胡三汉1 天前
GLB与GLTF:有什么区别——你应该用哪一个?
3d·gltf
玖玥拾1 天前
Unity 3D 笔记(八)ScrollRect 滚动视图、NavMesh 自动寻路系统
笔记·3d·unity
极客侃科技2 天前
如何把真人动作迁移到3D角色上?用V2Fun完成视频动捕和动作应用
3d