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
| <!DOCTYPE html> <html lang="en">
<head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <style> .card { width: 200px; margin: 200px auto; position: relative; transition: 0.5s; }
.card img { width: 200px; height: 200px; position: absolute; transition: 0.5s; }
.card img:first-child { /* 背面不可见 */ backface-visibility: hidden; transform: rotateY(0deg); }
.card img:nth-child(2) { transform: rotateY(180deg); backface-visibility: hidden; }
.card:hover img:first-child { transform: rotateY(180deg); }
.card:hover img:nth-child(2) { transform: rotateY(0deg); } </style>
<body> <div class="card"> <img src="./imgs/KRtDLD_Flare_Beam_Ability_Star_artwork.png" alt=""> <img src="./imgs/KRtDLD_Snow_Bowl_Ability_Star_artwork.png" alt=""> </div> <script> </script> </body>
</html>
|
也可以不使用backface-visibility,而使用3dCSS直接指定两张卡片的纵深位置