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>
相关推荐
昔人'1 小时前
css`scrollbar-gutter`防止滚动条可见性变化时发生布局偏移
前端·css
在下Z.5 小时前
前端基础--css(1)
前端·css
小帆聊前端5 小时前
CSS 选择器全解析:从基础语法到组件库样式修改,解决前端样式定位难题
css
某柚啊6 小时前
iOS移动端H5键盘弹出时页面布局异常和滚动解决方案
前端·javascript·css·ios·html5
昔人'8 小时前
使用css `focus-visible` 改善用户体验
前端·css·ux
CV实验室15 小时前
TIP 2025 | 哈工大&哈佛等提出 TripleMixer:攻克雨雪雾干扰的3D点云去噪网络!
人工智能·计算机视觉·3d·论文
小Tomkk17 小时前
Rokid 开发空间小程序 实战
3d·小程序·rokid·jsar
向宇it18 小时前
【unity实战】MapMagic 2实战例子
游戏·3d·unity·c#·游戏引擎
郝学胜-神的一滴1 天前
Three.js光照技术详解:为3D场景注入灵魂
开发语言·前端·javascript·3d·web3·webgl
列兵阿甘1 天前
知微传感Dkam系列3D相机SDK例程篇:Python获取内外参
python·数码相机·3d