<html> <head> <meta charset="utf-8" /> <title>cube3D立方体</title> <style> body { margin: 0px; padding: 0px; perspective: 1000px; /*设置景深*/ transform-style: preserve-3d; } #triangle div { position: absolute; width: 200px; height: 200px; border: 1px solid red; } #triangle:hover { transform: rotateY(360deg); transition: 5s; } #triangle{ position: relative; top: 40%; left: 0; width: 200px; height: 200px; border: 1px solid #333; margin: 0px auto; transform-style: preserve-3d; transform-origin: 50% 50% 50px; transform: rotateY(0deg); } #triangle div:nth-child(1) { position: absolute; } #triangle div:nth-child(2) { position: absolute; transform-origin: left center; transform: rotateY(-60deg); } #triangle div:nth-child(3) { position: absolute; transform-origin: right center; transform: rotateY(60deg); } </style> </head> <body> <div id="triangle"> <div>1</div> <div>2</div> <div>3</div> </div> </body> </html> 上面写的一个demo可以参考修改下
上面写的一个demo可以参考修改下