为甚麽无法实现3d效果
为什么无法实现3D效果,
程序代码:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>3d旋转的练习</title> <style> body { perspective: 1000px; } section { width: 300px; height: 200px; margin: 100px auto; background: url(images/z1.jpg) no-repeat; background-size: cover; position: relative; transform-style: preserve-3d; transition: all 5s linear; } section div img { width: 100%; height: 100%; position: absolute; left: 0; top: 0; } section div:nth-child(1) img { transform: rotateY(0deg) translateZ(400px); } section div:nth-child(2) img { transform: rotateY(60deg) translateZ(400px); } section div:nth-child(3) img { transform: rotateY(120deg) translateZ(400px); } section div:nth-child(4) img { transform: rotateY(180deg) translateZ(400px); } section div:nth-child(5) img { transform: rotateY(240deg) translateZ(400px); } section div:nth-child(6) img { transform: rotateY(300deg) translateZ(400px); } section:hover { transform: rotateY(360deg); } </style> </head> <body> <section> <div><img src="images/1.jpg" /></div> <div><img src="images/2.jpg" /></div> <div><img src="images/3.jpg" /></div> <div><img src="images/4.jpg" /></div> <div><img src="images/5.jpg" /></div> <div><img src="images/6.jpg" /></div> </section> </body> </html>