CSS: transform-style
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> body{ /* .box .box>div 都开启透视效果 */ perspective: 500px; } .box{ position: relative; width: 200px; height: 200px; margin: 100px auto; /* 子元素 .box>div 保持3d空间 */ transform-style: preserve-3d; transform: rotateY(60deg); } .box div{ position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: palegoldenrod; } .box div:last-child{ background-color: teal; transform: rotateX(60deg); } </style> </head> <body> <div class="box"> <div></div> <div></div> </div> </body> </html>