<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>层叠</title>
<style>
body {
margin: 0;
padding: 0;
100%;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.container {
position: relative;
360px;
height: 640px;
margin-top: 150px;
background: rgba(0, 0, 0, 1);
transform: rotate(-10deg) skew(30deg) scale(.8);
transition: 0.5s;
}
.container img {
100%;
height: 100%;
position: absolute;
transition: 0.5s;
}
.container:hover img:nth-child(4){
transform: translate(80px, -80px);
opacity: 1;
}
.container:hover img:nth-child(3){
transform: translate(60px, -60px);
opacity: .8;
}
.container:hover img:nth-child(2){
transform: translate(40px, -40px);
opacity: .6;
}
.container:hover img:nth-child(1){
transform: translate(20px, -20px);
opacity: .4;
}
</style>
</head>
<body>
<div class="container">
<img src="./tx.jpg" alt="">
<img src="./tx.jpg" alt="">
<img src="./tx.jpg" alt="">
<img src="./tx.jpg" alt="">
</div>
</body>
</html>
效果如下:
怎么样?炫酷吧。
ps:图片上的人物是优雅的汉尼拔·莱克特医生
如果你有什么更有意思的CSS效果,欢迎交流。