1. 代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style type="text/css">
body {
perspective: 1000px;
}
section {
width: 250px;
height: 160px;
margin: 100px auto;
background: url(images/tfboys1.jpg) no-repeat;
background-size: cover;
position: relative;
transform-style: preserve-3d;/*让父盒子里面的子盒子以3d效果显示*/
transition: all 15s linear;/*匀速,all可以省略*/
}
section:hover {
transform: rotateY(360deg);
}
section div {
width: 100%;
height: 100%;
background: url(images/tfboys2.jpg) no-repeat;
background-size: cover;
position: absolute;
}
section div:nth-child(1) {
transform: rotateY(0deg) translateZ(400px);
}
section div:nth-child(2) {
transform: rotateY(60deg) translateZ(400px);
}
section div:nth-child(3) {
transform: rotateY(120deg) translateZ(400px);
}
section div:nth-child(4) {
transform: rotateY(180deg) translateZ(400px);
}
section div:nth-child(5) {
transform: rotateY(240deg) translateZ(400px);
}
section div:nth-child(6) {
transform: rotateY(300deg) translateZ(400px);
}
</style>
</head>
<body>
<section>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</section>
</body>
</html>
2. 效果图(鼠标悬停时旋转)