Html实现立体相册

效果图:

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);
}

你可能感兴趣的:(前端,css,html,html5)