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
| <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>3D</title> <style> h2,p{ padding: 0; margin: 0; } .view{ width: 300px; height: 150px; overflow: hidden; perspective: 400px; margin: 4px; } .three{ transform-style: preserve-3d; transform-origin: right center 0; position: relative; width: 100%; height: 100%; transition: all 0.6s ease-in-out; } img{ width: 300px; height: 150px; } .front,.back{ position: absolute; backface-visibility: hidden; width: 100%; height: 100%; } .back{ transform: rotateY(0.5turn); } .three:hover{ transform: translateX(-100%) rotateY(-180deg); }
.back{ background: #c00; } .back h3{ margin: 10px; font-size: 16px; text-align: center; } .back p{ color: #fff; text-indent: 2em; font-size: 14px; line-height: 25px; padding: 3px; }
</style> </head> <body> <div class="view"> <div class="three"> <div class="front"> <img src="../Day1/3.jpg" alt=""> </div> <div class="back"> <img src="../Day1/2.png" alt=""> </div> </div> </div>
<div class="view"> <div class="three"> <div class="front"> <img src="../Day1/2.png"> </div> <div class="back"> <h3>这里是文字</h3> </div> </div> </div> </body> </html>
|