1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
| <!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> * { margin: 0; padding: 0; } section { width: 200px; height: 200px; margin: 100px auto; perspective: 10000px; } .box { width: 200px; height: 200px; perspective: 10000px; position: relative; transform-style: preserve-3d; transition:all 10s ease 0s; }
section:hover .box { transform: rotateX(360deg) rotateY(360deg); }
.box p { position: absolute; top: 0; left: 0; width: 200px; height: 200px; }
.box p:nth-child(1) { background-color: rgba(219, 56, 211, 0.486); transform: translateZ(100px); }
.box p:nth-child(2) { background-color: rgba(42, 128, 199, 0.486); transform: rotateX(90deg) translateZ(100px); }
.box p:nth-child(3) { background-color: rgba(56, 219, 83, 0.486); transform: rotateX(180deg) translateZ(100px); }
.box p:nth-child(4) { background-color: rgba(213, 216, 32, 0.486); transform: rotateX(-90deg) translateZ(100px); }
.box p:nth-child(5) { background-color: rgba(236, 82, 102, 0.486); transform: rotateY(90deg) translateZ(100px); }
.box p:nth-child(6) { background-color: rgba(119, 17, 236, 0.486); transform: rotateY(-90deg) translateZ(100px); } </style> </head>
<body> <section> <div class="box"> <p></p> <p></p> <p></p> <p></p> <p></p> <p></p> </div> </section> </body> </html>
|