image.png

制作思想

  • subnav-entry ul大盒子,10个li
  • li 里面包 a
  • a 里面包 2个span
  • ul 用display:flex
  • li flex:20%

index.html

  1. <!-- 侧导航栏 -->
  2. <ul class="subnav-entry">
  3. <li>
  4. <a href="#">
  5. <span class="subnav-entry-icon"></span>
  6. <span>WiFi电话卡</span>
  7. </a>
  8. </li>
  9. <li>
  10. <a href="#">
  11. <span class="subnav-entry-icon"></span>
  12. <span>WiFi电话卡</span>
  13. </a>
  14. </li>
  15. <li>
  16. <a href="#">
  17. <span class="subnav-entry-icon"></span>
  18. <span>WiFi电话卡</span>
  19. </a>
  20. </li>
  21. <li>
  22. <a href="#">
  23. <span class="subnav-entry-icon"></span>
  24. <span>WiFi电话卡</span>
  25. </a>
  26. </li>
  27. <li>
  28. <a href="#">
  29. <span class="subnav-entry-icon"></span>
  30. <span>WiFi电话卡</span>
  31. </a>
  32. </li>
  33. <li>
  34. <a href="#">
  35. <span class="subnav-entry-icon"></span>
  36. <span>WiFi电话卡</span>
  37. </a>
  38. </li>
  39. <li>
  40. <a href="#">
  41. <span class="subnav-entry-icon"></span>
  42. <span>WiFi电话卡</span>
  43. </a>
  44. </li>
  45. <li>
  46. <a href="#">
  47. <span class="subnav-entry-icon"></span>
  48. <span>WiFi电话卡</span>
  49. </a>
  50. </li>
  51. <li>
  52. <a href="#">
  53. <span class="subnav-entry-icon"></span>
  54. <span>WiFi电话卡</span>
  55. </a>
  56. </li>
  57. <li>
  58. <a href="#">
  59. <span class="subnav-entry-icon"></span>
  60. <span>WiFi电话卡</span>
  61. </a>
  62. </li>
  63. </ul>

index.css

/* 侧导航栏 */
.subnav-entry {
  display: flex;
  flex-wrap: wrap;
  border-radius: 10px;
  margin: 0 5px;
  padding: 4px 0;
  background-color: #fff;
}

.subnav-entry li {
  flex: 20%;
}

.subnav-entry li a {
  display: flex;
  margin-top: 4px;
  flex-direction: column;
  align-items: center;
}

.subnav-entry-icon {
  width: 28px;
  height: 28px;
  background: url(../images/subnav-bg.png) no-repeat;
  background-size: 28px auto;
}