练习题2_简易照片墙.html 1022 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. background-color: #ccc;
  10. perspective: 1000px;
  11. perspective-origin: center center;
  12. }
  13. .box{
  14. width: 400px;
  15. height: 400px;
  16. border:3px dashed black;
  17. margin:200px auto;
  18. transform-style: preserve-3d;
  19. }
  20. .box img{
  21. width: 100%;
  22. transition: all 1s ease;
  23. }
  24. .box img:first-child{
  25. transform: rotate(45deg);
  26. }
  27. .box img:last-child{
  28. transform: rotate(-45deg);
  29. }
  30. .box img:hover{
  31. transform: rotate(0) translateZ(500px);
  32. }
  33. </style>
  34. </head>
  35. <body>
  36. <div class="box">
  37. <img src="./img/slider1.jpg" alt="img">
  38. <img src="./img/slider2.jpg" alt="img">
  39. </div>
  40. </body>
  41. </html>