练习题2_简易照片墙.html 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. /* 观察者距离 */
  10. perspective: 1000px;
  11. /* 观察者视角位置 */
  12. /* perspective-origin: right bottom; */
  13. /* perspective-origin: 100px 10px; */
  14. }
  15. .box{
  16. width: 400px;
  17. height: 400px;
  18. border:1px dashed black;
  19. margin:100px auto;
  20. transform-style: preserve-3d;
  21. }
  22. .box img{
  23. width: 400px;
  24. transition: all .5s linear;
  25. }
  26. .box img:nth-child(1){
  27. transform: rotate(15deg);
  28. }
  29. .box img:nth-child(2){
  30. transform: rotate(-15deg);
  31. }
  32. .box img:nth-child(1):hover{
  33. /* transform: rotate(0) scale(2); */
  34. /* transform: translateZ(500px) rotate(0); */
  35. transform: translateZ(500px);
  36. }
  37. .box img:nth-child(2):hover{
  38. /* transform: rotate(0) scale(2); */
  39. transform: translateZ(300px);
  40. }
  41. </style>
  42. </head>
  43. <body>
  44. <div class="box">
  45. <img src="./img/image3.png" alt="img">
  46. <img src="./img/image4.png" alt="img">
  47. </div>
  48. </body>
  49. </html>