用纯CSS实现照片墙

首先需要引入指定的照片,编写html代码




    
    照片墙
    



然后再引入CSS代码

*{
    margin:0;
    padding: 0;
}
body{
    background-color: #eee;
}
.container{
    width: 960px;
    height: 450px;
    margin:60px auto;
    position: relative;
}
.pic{
    width: 160px;
}
.container img{
    padding: 10px 10px 15px;
    background: #fff;
    border:1px solid #ddd;
    box-shadow: 2px 2px 3px rgba(50,50,50,0.4);
    -webkit-transition: all 0.5s ease-in;
    -moz-transition: all 0.5s ease-in;
    -ms-transition: all 0.5s ease-in;
    -o-transition: all 0.5s ease-in;
    transition: all 0.5s ease-in;
    z-index: 1;
    position: absolute;
}
.container img:hover{
    cursor: pointer;
    box-shadow: 15px 15px 20px rgba(50,50,50,0.4);
    transform: rotate(0deg) scale(1.20);
    -webkit-transform: rotate(0deg) scale(1.20);
    z-index: 2;
}
.pic1{
    left:0px;
    top:0;
    transform: rotate(-5deg);
    -webkit-transform:rotate(-5deg);
}
.pic2{
    left:160px;
    top:0;
    transform: rotate(-20deg);
    -webkit-transform:rotate(-20deg);
}
.pic3{
    left:320px;
    top:0;
    transform: rotate(5deg);
    -webkit-transform:rotate(5deg);
}
.pic4{
    top:0px;
    left:480px;
    transform: rotate(-10deg);
    -webkit-transform:rotate(-10deg);
}
.pic5{
    top:0px;
    left:640px;
    transform: rotate(-10deg);
    -webkit-transform:rotate(-10deg);
}
.pic6{
    top:300px;
    left:0;
    transform: rotate(10deg);
    -webkit-transform:rotate(10deg);
}
.pic7{
    top:300px;
    left:200px;
    transform: rotate(20deg);
    -webkit-transform:rotate(20deg);
}
.pic8{
    top:300px;
    left:400px;
    transform: rotate(5deg);
    -webkit-transform:rotate(5deg);
}
.pic9{
    top:300px;
    left:600px;
    transform: rotate(15deg);
    -webkit-transform:rotate(15deg);
}

最后实现的效果

用纯CSS实现照片墙_第1张图片

你可能感兴趣的:(CSS)