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>
相关推荐
lilian2335 小时前
HarmonyOS 7 新特性(十三)|3DGS 模型加载、交互与性能回退
3d·交互·harmonyos
CarIise5 小时前
事件传播、CSS动画、服务器字体与jQuery
服务器·css·jquery
XLYcmy6 小时前
HTML/CSS/JS 基础与 Vue 技术栈深度解析
java·前端·css·html·vue3·vue2·api
风月说与山鬼6 小时前
四、Tailwind CSS——间距与尺寸
前端·css·tailwind css
风月说与山鬼6 小时前
三、Tailwind CSS——排版与文字样式
前端·css·tailwind css
里欧跑得慢9 小时前
AI 驱动的 UI 国际化方案自动适配:从单一语言到多语言布局的智能转换
前端·css·flutter·web
DolitD9 小时前
云流技术深度剖析:单服务器下如何实现3D应用的多实例并发?
java·服务器·前端·3d·云原生·云计算
Liudef069 小时前
腾讯混元Hunyuan3D-Part:重新定义3D部件生成的革命性架构
人工智能·3d·架构·腾讯混元hunyuan3d
晓得迷路了9 小时前
栗子前端技术周刊第 144 期 - Rspack 2.2、pnpm 12、Solid 2.0 RC...
前端·javascript·css
2601_967659891 天前
大学实训室网络仿真环境搭建:Ranplan 3D射线跟踪双版本技术解析
网络·3d