练习9_DOM放大镜.html 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. *{
  9. margin: 0;
  10. padding: 0;
  11. }
  12. .small-img{
  13. width: 400px;
  14. height: 400px;
  15. position: relative;
  16. float: left;
  17. }
  18. .small-img img{
  19. width: 100%;
  20. height: 100%;
  21. }
  22. .small-img .mask{
  23. width: 200px;
  24. height: 200px;
  25. background-color: rgba(255,255,255,0.5);
  26. position: absolute;
  27. top: 0;
  28. left: 0;
  29. }
  30. .big-img{
  31. width: 400px;
  32. height: 400px;
  33. float: left;
  34. overflow: hidden;
  35. margin-left: 20px;
  36. }
  37. .big-img img{
  38. width: 800px;
  39. height: 800px;
  40. }
  41. </style>
  42. </head>
  43. <body>
  44. <div class="container">
  45. <div class="small-img">
  46. <img src="./image/niu.png" alt="img">
  47. <div class="mask"></div>
  48. </div>
  49. <div class="big-img">
  50. <img src="./image/niu.png" alt="img">
  51. </div>
  52. </div>
  53. </body>
  54. </html>