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>
相关推荐
Fan_web5 小时前
jQuery——事件委托
开发语言·前端·javascript·css·jquery
安冬的码畜日常5 小时前
【CSS in Depth 2 精译_044】第七章 响应式设计概述
前端·css·css3·html5·响应式设计·响应式
赛男丨木子丿小喵6 小时前
visual studio2022添加新项中没有html和css
css·html·visual studio
太阳花ˉ8 小时前
html+css+js实现step进度条效果
javascript·css·html
懒羊羊大王呀10 小时前
CSS——属性值计算
前端·css
看到请催我学习12 小时前
如何实现两个标签页之间的通信
javascript·css·typescript·node.js·html5
先生沉默先12 小时前
3dsMax合并FBX的时候相同的节点会被合并(重命名解决),3Ds MAX创建空物体(虚拟对象或者点)
3d·3dsmax
昨天;明天。今天。13 小时前
案例-任务清单
前端·javascript·css
惜.己15 小时前
javaScript基础(8个案例+代码+效果图)
开发语言·前端·javascript·vscode·css3·html5
Death20015 小时前
Qt 3D、QtQuick、QtQuick 3D 和 QML 的关系
c语言·c++·qt·3d·c#