博客列表 >作业-九宫格

作业-九宫格

晓文
晓文原创
2022年05月07日 23:04:53409浏览
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>背景定位九宫格</title>
  6. <style>
  7. body{
  8. padding: 10px 0 10px 0; margin:0;
  9. }
  10. .cell{
  11. width:300px; height: auto; overflow: hidden; margin: 0 auto;
  12. }
  13. .cell > .cell-item{
  14. width:100px; height: 100px; background-image: url('https://img.php.cn/upload/image/677/687/658/1651935342393288.jpg'); background-repeat: no-repeat; float: left;
  15. }
  16. .cell > .cell-item:nth-child(1){
  17. background-position: -11px -8px;
  18. }
  19. .cell > .cell-item:nth-child(2){
  20. background-position: -121px -8px;
  21. }
  22. .cell > .cell-item:nth-child(3){
  23. background-position: -231px -8px;
  24. }
  25. .cell > .cell-item:nth-child(4){
  26. background-position: -341px -8px;
  27. }
  28. .cell > .cell-item:nth-child(5){
  29. background-position: -451px -8px;
  30. }
  31. .cell > .cell-item:nth-child(6){
  32. background-position: -561px -8px;
  33. }
  34. .cell > .cell-item:nth-child(7){
  35. background-position: -671px -8px;
  36. }
  37. .cell > .cell-item:nth-child(8){
  38. background-position: -781px -8px;
  39. }
  40. .cell > .cell-item:nth-child(9){
  41. background-position: -891px -8px;
  42. }
  43. </style>
  44. </head>
  45. <body>
  46. <div class="cell">
  47. <div class="cell-item"></div>
  48. <div class="cell-item"></div>
  49. <div class="cell-item"></div>
  50. <div class="cell-item"></div>
  51. <div class="cell-item"></div>
  52. <div class="cell-item"></div>
  53. <div class="cell-item"></div>
  54. <div class="cell-item"></div>
  55. <div class="cell-item"></div>
  56. </div>
  57. </body>
  58. </html>
上一条:作业-导航菜单下一条:MVC示例演示
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议