Html实现立体相册

效果图:

html主体:(图片自己修改地址,图片大小最好保持一致的大小可自行调节)

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>立体相册</title>
<link rel="stylesheet" href="css/demo.css">
</head>

<body>
<div id="react">
    <div class="out_frount">
        <img src="img/f1.jpg" class="out_pic">
    </div>
    <div class="out_back">
        <img src="img/f2.jpg" class="out_pic">
    </div>
    <div class="out_left">
        <img src="img/f3.jpg" class="out_pic">
    </div>
    <div class="out_right">
        <img src="img/f4.jpg" class="out_pic">
    </div>
    <div class="out_top">
        <img src="img/f5.jpg" class="out_pic">
    </div>
    <div class="out_bottom">
        <img src="img/f6.jpg" class="out_pic">
    </div>
    <span class="in_frount">
        <img src="img/f7.jpg" class="in_pic">
    </span>
    <span class="in_back">
        <img src="img/f8.jpg" class="in_pic">
    </span>
    <span class="in_left">
        <img src="img/f9.jpg" class="in_pic">
    </span>
    <span class="in_right">
        <img src="img/f10.jpg" class="in_pic">
    </span>
    <span class="in_top">
        <img src="img/f11.jpg" class="in_pic">
    </span>
    <span class="in_bottom">
        <img src="img/f12.jpg" class="in_pic">
    </span>
</div>
</body>
</html>

css

*{
    padding:0;
    margin:0;
}
body{
    width:100%;
    height:100%;
    background:linear-gradient(lightpink 0%,greenyellow 100%);
}
#react{
    width: 300px;
    height:300px;
    margin: 300px auto;
    transform-style:preserve-3d;
    animation:rotate 20s infinite;
    animation-timing-function: linear;
}
#react div{
    position:absolute;
    transition: all .5s;
}
div .out_pic{
    width:300px;
    height:300px;
    opacity:0.9;
}
div .in_pic{
    width:200px;
    height:200px;
}
#react span{
    display:block;
    position:absolute;
    width:200px;
    height:200px;
    top:50px;
    left:50px;
}
@keyframes rotate{
    from{transform: rotateX(0deg) rotateY(0deg);}
    to{transform: rotateX(360deg) rotateY(360deg);}
}
.out_frount{
    transform:translateZ(150px);
}
.out_back{
    transform:translateZ(-150px);
}
.out_left{
    transform:rotateY(90deg) translateZ(150px);
}
.out_right{
    transform: rotateY(-90deg) translateZ(150px);
}
.out_top{
    transform:rotateX(90deg) translateZ(150px);
}
.out_bottom{
    transform: rotateX(-90deg) translateZ(150px);
}
.in_frount{
    transform:translateZ(100px);
}
.in_back{
    transform:translateZ(-100px);
}
.in_left{
    transform:rotateY(90deg) translateZ(100px);
}
.in_right{
    transform: rotateY(-90deg) translateZ(100px);
}
.in_top{
    transform:rotateX(90deg) translateZ(100px);
}
.in_bottom{
    transform: rotateX(-90deg) translateZ(100px);
}
#react:hover .out_frount{
    transform:translateZ(300px);
}
#react:hover .out_back{
    transform:translateZ(-300px);
}
#react:hover .out_left{
    transform:rotateY(90deg) translateZ(300px);
}
#react:hover .out_right{
    transform: rotateY(-90deg) translateZ(300px);
}
#react:hover .out_top{
    transform:rotateX(90deg) translateZ(300px);
}
#react:hover .out_bottom{
    transform: rotateX(-90deg) translateZ(300px);
}

  • 8
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

CJ.Williams

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值