练习题2_照片墙.html 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. <style>
  8. body{
  9. perspective: 1000px;
  10. }
  11. .box{
  12. width: 400px;
  13. height: 400px;
  14. border:1px dashed black;
  15. margin:100px auto;
  16. transform-style: preserve-3d;
  17. }
  18. .box img{
  19. width: 300px;
  20. transition: all 1s linear;
  21. }
  22. .box img:nth-child(1){
  23. transform: rotate(45deg);
  24. }
  25. .box img:nth-child(2){
  26. transform: rotate(-45deg);
  27. }
  28. .box img:nth-child(1):hover{
  29. transform:rotate(180deg) scale(2) translateZ(2px);
  30. }
  31. .box img:nth-child(2):hover{
  32. transform: translateZ(500px);
  33. }
  34. </style>
  35. </head>
  36. <body>
  37. <div class="box">
  38. <img src="./img/image1.png" alt="">
  39. <img src="./img/image.png" alt="">
  40. </div>
  41. </body>
  42. </html>