简单利用position, transform,rotate制作如下照片墙效果,鼠标点击放大当前图片并且覆盖其他照片。
主体部分:index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
#链接样式部分
<link rel="stylesheet" type="text/css" href="css/new_file.css"/>
</head>
<body>
<div class="box" id="box">
#以下为图片地址
<img src="img/10.jpg" >
<img src="img/2.jpg" >
<img src="img/3.jpg" >
<img src="img/4.jpg" >
<img src="img/5.jpg" >
<img src="img/6.jpg" >
<img src="img/7.jpg" >
<img src="img/8.jpg" >
<img src="img/9.jpg" >
<img src="img/1.jpg" >
</div>
</body>
</html>
CSS部分:new_file.css
div img:nth-child(even){
width: 200px;
}
div img:nth-child(odd){
width: 300px;
}
.box{
margin: 300px auto;
width: 940px;
position: relative;
}
.box img{
padding: 1px solid #ddd;
border: 10px;
position: absolute;
background: #fff;
z-index:1;
}
.box img:nth-child(1){
top: 0px;
left: 30px;
transform: rotate(-15deg);
}
.box img:nth-child(2){
top: -50px;
left: 600px;
transform: rotate(-20deg);
}
.box img:nth-child(3){
bottom: 0;
right: 0;
transform: rotate(15deg);
}
.box img:nth-child(4){
bottom: 0;
left: 400px;
transform: rotate(-20deg);
}
.box img:nth-child(5){
bottom: 0;
left: 600px;
transform: rotate(-30deg);
}
.box img:nth-child(6){
top: 0;
left: 0;
transform: rotate(20deg);
}
.box img:nth-child(7){
top: 0;
left: 700px;
transform: rotate(20deg);
}
.box img:nth-child(8){
bottom: -20px;
right: 500px;
transform: rotate(30deg);
}
.box img:nth-child(9){
top: 90px;
left: 550px;
transform: rotate(15deg);
}
.box img:nth-child(10){
top: 20px;
left: 350px;
transform: rotate(-10deg);
}
#box img:hover{
box-shadow: 5px 5px 5px #ddd;
z-index: 2;
transform: rotate(0deg) scale(1.5);
}