代码
提交代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> body{ perspective: 500px; transform-style: preserve-3d; } .commn{ width:100px; height:100px; text-align: center; line-height: 100px; background:#f2f2f2; border:1px solid #ccc; position: absolute; top: 0; left: 0; } .demo{ z-index: 1; opacity: .5; background: red; } .demo-3d{ transform:translate3d(100px ,100px ,-100px) rotateZ(45deg); } </style> </head> <body> <div class="commn demo">transfrom3d</div> <div class="commn demo-3d">transfrom3d</div> </body> </html>
运行结果