博客列表 >九宫格练习

九宫格练习

floraDeng?
floraDeng?原创
2022年05月09日 22:05:59366浏览

  1. 9宫格
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8">
  6. <title>number</title>
  7. </head>
  8. <style>
  9. div{
  10. width: 100px;
  11. height: 100px;
  12. background-image: url("img/123456.jpg");
  13. }
  14. .big{
  15. width: 300px;
  16. height: 300px;
  17. }
  18. .squ1{
  19. background-position: -11px -8px;
  20. }
  21. .squ2{
  22. position: relative;
  23. top:-100px;
  24. left:100px;
  25. background-position: -121px -9px;
  26. }
  27. .squ3{
  28. background-color: #f6c090;
  29. position: relative;
  30. top:-200px;
  31. left:200px;
  32. background-position: -231px -9px;
  33. }
  34. .squ4{
  35. background-color: pink;
  36. position: relative;
  37. top:-200px;
  38. background-position: -340px -9px;
  39. }
  40. .squ5{
  41. background-color: blueviolet;
  42. position: relative;
  43. top:-300px;
  44. left:100px;
  45. background-position: -450px -9px;
  46. }
  47. .squ6{
  48. position: relative;
  49. top:-400px;
  50. left:200px;
  51. background-position: -560px -9px;
  52. }
  53. .squ7{
  54. position: relative;
  55. top:-400px;
  56. background-position: -670px -9px;
  57. }
  58. .squ8{
  59. position: relative;
  60. top:-500px;
  61. left:100px;
  62. background-position: -782px -9px;
  63. }
  64. .squ9{
  65. position: relative;
  66. top:-600px;
  67. left:200px;
  68. background-position: -892px -9px;
  69. }
  70. </style>
  71. <body>
  72. <div class="big">
  73. <div class="squ1"></div>
  74. <div class="squ2"></div>
  75. <div class="squ3"></div>
  76. <div class="squ4"></div>
  77. <div class="squ5"></div>
  78. <div class="squ6"></div>
  79. <div class="squ7"></div>
  80. <div class="squ8"></div>
  81. <div class="squ9"></div>
  82. </div>
  83. </body>
  84. </html>
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议