长方体效果相对于正方体效果,其实就是修改了一下宽高,但是如果不仔细的看,理解起来还是有一定的难度的,那么我们再来梳理一下吧
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 | <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <style> * { margin: 0; padding: 0} ul {list-style: none;} ul { width: 200px; height: 200px; margin: 100px auto; position: relative; transition: all 6s; transform-style: preserve-3d; transform: scaleX(2.5) scaleY(1.5) rotateX(0deg) rotateY(0deg); } ul:hover { transform:scaleX(2.5) scaleY(1.5) rotateX(360deg) rotateY(360deg); } ul li { width: 100%; height: 100%; text-align: center; line-height: 200px; color: white; font-size:40px; position: absolute; } ul li:nth-child(1) { transform: rotateX(0deg) translateZ(100px); background:rgba(255,0,0,.6) ; } ul li:nth-child(2) { background:rgba(0,255,0,.6); transform: rotateX(-90deg) translateZ(100px); } ul li:nth-child(3) { background:rgba(0,0,255,.6); transform: rotateX(-180deg) translateZ(100px); } ul li:nth-child(4) { background:rgba(0,255,255,.6); transform: rotateX(-270deg) translateZ(100px); } ul li:nth-child(5) { background:rgba(255,0,255,.6); transform: rotateY(-90deg) translateZ(100px); } ul li:nth-child(6) { background:rgba(23,0,45,.6); transform: rotateY(90deg) translateZ(100px); } </style> </head> <body> <ul> <li>第1个盒子</li> <li>第2个盒子</li> <li>第3个盒子</li> <li>第4个盒子</li> <li>第5个盒子</li> <li>第6个盒子</li> </ul> </body> </html> |
长方体效果相对于正方体效果,就这介绍到这里啦,以后会带来更好的事例供大家来了解前端
7