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>
相关推荐
float_六七19 小时前
CSS行内盒子:30字掌握核心特性
前端·css
donecoding20 小时前
CSS的"双胞胎"陷阱:那些看似对称却暗藏玄机的属性对
前端·css·代码规范
未来之窗软件服务20 小时前
幽冥大陆(九十九)文件大小换算+软考—东方仙盟练气期
css·html·css3·计算机软考·仙盟创梦ide·东方仙盟
成都渲染101云渲染666620 小时前
Maya 正在被 Blender 取代吗?从实际项目说点不太好听的实话
3d·blender·maya
CG_MAGIC21 小时前
SketchUp新手高频问题全解攻略
3d·云渲染·建模教程·渲云渲染·3d软件
gaosushexiangji21 小时前
基于3D3C-PIV的超音速火焰喷口近场三维速度与涡结构测量实验
数码相机·3d
thinkQuadratic21 小时前
CSS给文本添加背景颜色等效果
前端·css
rit843249921 小时前
MATLAB利用二维图像生成3D形状的核心方法与实现
计算机视觉·matlab·3d
zl_vslam21 小时前
SLAM中的非线性优-3D图优化之绝对位姿SE3约束左扰动(十六)
人工智能·算法·计算机视觉·3d
C_心欲无痕21 小时前
前端网站主题切换原理与实践:CSS 类名切换方案
前端·css