当前位置:   article > 正文

HTML5+CSS3实现小米商城(有源码)_小米商城菜单html代码

小米商城菜单html代码

前言

这个小米商城用到了html+css,内容是2023年11月份的。

因为没有使用js,所以结构相对简单,比较容易理解,适合刚学完css的朋友。

一.效果展示

二.部分代码展示

1.头部

  1. <!-- 头部 -->
  2. <div class="header">
  3. <!-- 黑色头部 -->
  4. <div class="top_header">
  5. <!-- 内容 -->
  6. <div class="container">
  7. <!-- 品类名字 -->
  8. <div class="name_top">
  9. <a href="#" class="nofollow">小米官网</a>
  10. <span class="sep">|</span>
  11. <a href="#" class="nofollow">小米商城</a>
  12. <span class="sep">|</span>
  13. <a href="#" class="nofollow">小米澎湃OS</a>
  14. <span class="sep">|</span>
  15. <a href="#" class="nofollow">IoT</a>
  16. <span class="sep">|</span>
  17. <a href="#" class="nofollow">云服务</a>
  18. <span class="sep">|</span>
  19. <a href="#" class="nofollow">天星数科</a>
  20. <span class="sep">|</span>
  21. <a href="#" class="nofollow">有品</a>
  22. <span class="sep">|</span>
  23. <a href="#" class="nofollow">小爱开放平台</a>
  24. <span class="sep">|</span>
  25. <a href="#" class="nofollow">资质证照</a>
  26. <span class="sep">|</span>
  27. <a href="#" class="nofollow">协议规则</a>
  28. <span class="sep">|</span>
  29. <a href="#" class="nofollow">下载app</a>
  30. <span class="sep">|</span>
  31. <a href="#" class="nofollow">Select Location</a>
  32. </div>
  33. <!-- 购物车 -->
  34. <div class="car_top">
  35. <a href="#">
  36. <em class="iconfont icon-gouwuche"></em>
  37. 购物车
  38. <span>(0)</span>
  39. </a>
  40. </div>
  41. <!-- 信息通知 -->
  42. <div class="txt_top">
  43. <a href="#">登录</a>
  44. <span class="sep">|</span>
  45. <a href="#">注册</a>
  46. <span class="sep">|</span>
  47. <span class="message">
  48. <a href="#">消息通知</a>
  49. </span>
  50. </div>
  51. </div>
  52. </div>
  53. <!-- 白色部分 -->
  54. <div class="middle_header">
  55. <!-- 版心居中 -->
  56. <div class="container">
  57. <!-- 小米logo -->
  58. <div class="header_logo">
  59. <a href="#">小米商城</a>
  60. </div>
  61. <!-- 弹窗文字 -->
  62. <div class="header_nav">
  63. <ul class="nav_list">
  64. <li class="nav-category"></li>
  65. <li><a href="#">Xiaomi手机</a></li>
  66. <li><a href="#">Redmi手机</a></li>
  67. <li><a href="#">电视</a></li>
  68. <li><a href="#">笔记本</a></li>
  69. <li><a href="#">平板</a></li>
  70. <li><a href="#">家电</a></li>
  71. <li><a href="#">路由器</a></li>
  72. <li><a href="#">服务中心</a></li>
  73. <li><a href="#">社区</a></li>
  74. </ul>
  75. </div>
  76. <!-- 搜索 -->
  77. <div class="header_search">
  78. <div class="text"><input type="text"></div>
  79. <div class="iconfont icon-sousuo" id="serarch"></div>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  1. /* 头部 */
  2. .header {
  3. width: 100%;
  4. height: 140px;
  5. /* background-color: #b0b0b0; */
  6. }
  7. /* 黑色部分 */
  8. .header .top_header {
  9. position: relative;
  10. height: 40px;
  11. font-size: 12px;
  12. color: #b0b0b0;
  13. background-color: #333;
  14. }
  15. .header .top_header .container {
  16. width: 1226px;
  17. height: 40px;
  18. margin-right: auto;
  19. margin-left: auto;
  20. }
  21. /* 顶部品类区 */
  22. .header .top_header .container .name_top {
  23. float: left;
  24. height: 40px;
  25. line-height: 40px;
  26. }
  27. .name_top .sep {
  28. margin: 0 .3em;
  29. color: #424242;
  30. }
  31. .name_top a {
  32. color: #b0b0b0;
  33. line-height: 40px;
  34. display: inline-block;
  35. }
  36. .name_top a:hover {
  37. color: #fff;
  38. }
  39. /* 顶部注册信息区 */
  40. .header .top_header .container .txt_top {
  41. position: relative;
  42. float: right;
  43. height: 40px;
  44. line-height: 40px;
  45. }
  46. .txt_top .sep {
  47. margin: 0 .3em;
  48. color: #424242;
  49. }
  50. .txt_top a {
  51. color: #b0b0b0;
  52. line-height: 40px;
  53. display: inline-block;
  54. }
  55. .txt_top a:hover {
  56. color: #fff;
  57. }
  58. .txt_top .message {
  59. padding: 0 10px;
  60. }
  61. /* 顶部购物车 */
  62. .header .top_header .container .car_top {
  63. position: relative;
  64. float: right;
  65. width: 120px;
  66. height: 40px;
  67. line-height: 40px;
  68. margin-left: 15px;
  69. text-align: center;
  70. }
  71. .car_top .iconfont .icon-gouwuche {
  72. margin-right: 4px;
  73. font-size: 20px;
  74. line-height: 20px;
  75. vertical-align: -4px
  76. }
  77. /* 购物车超链接 */
  78. .car_top a {
  79. position: relative;
  80. font-size: 12px;
  81. display: block;
  82. height: 40px;
  83. line-height: 40px;
  84. text-align: center;
  85. color: #b0b0b0;
  86. background: #424242;
  87. }
  88. .car_top a:hover {
  89. background-color: #fff;
  90. color: #ff6700;
  91. }

2.轮播图

  1. <!-- 轮播图 -->
  2. <div class="carousel">
  3. <div class="img"><a href=""><img src="./img/小米14.png" alt=""></a></div>
  4. <!-- 侧边 -->
  5. <div class="site-category">
  6. <ul class="category">
  7. <li class="li-category">
  8. <a href="#">手机<em class="iconfont icon-youjiantou"></em></a>
  9. </li>
  10. <li class="li-category">
  11. <a href="#">电视<em class="iconfont icon-youjiantou"></em></a>
  12. </li>
  13. <li class="li-category">
  14. <a href="#">家电<em class="iconfont icon-youjiantou"></em></a>
  15. </li>
  16. <li class="li-category">
  17. <a href="#">笔记本 平板<em class="iconfont icon-youjiantou"></em></a>
  18. </li>
  19. <li class="li-category">
  20. <a href="#">出行 穿戴<em class="iconfont icon-youjiantou"></em></a>
  21. </li>
  22. <li class="li-category">
  23. <a href="#">耳机 音箱<em class="iconfont icon-youjiantou"></em></a>
  24. </li>
  25. <li class="li-category">
  26. <a href="#">健康 儿童<em class="iconfont icon-youjiantou"></em></a>
  27. </li>
  28. <li class="li-category">
  29. <a href="#">生活 箱包<em class="iconfont icon-youjiantou"></em></a>
  30. </li>
  31. <li class="li-category">
  32. <a href="#">智能 路由器<em class="iconfont icon-youjiantou"></em></a>
  33. </li>
  34. <li class="li-category">
  35. <a href="#">电源 配件<em class="iconfont icon-youjiantou"></em></a>
  36. </li>
  37. </ul>
  38. </div>
  1. /* 轮播图 */
  2. .app .carousel {
  3. position: relative;
  4. height: 670px;
  5. width: 1226px;
  6. overflow: hidden;
  7. margin-right: auto;
  8. margin-left: auto;
  9. }
  10. .app .carousel img {
  11. display: block;
  12. width: 1226px;
  13. height: 460px;
  14. }
  15. .carousel .site-category {
  16. position: absolute;
  17. top: 0;
  18. left: 0;
  19. width: 234px;
  20. height: 460px;
  21. border: 0;
  22. font-size: 14px;
  23. background: rgba(105,101,101,.6);
  24. color: #fff;
  25. }
  26. .carousel .site-category .category {
  27. height: 460px;
  28. margin: 0;
  29. padding: 20px 0;
  30. list-style-type: none;
  31. color: #424242;
  32. }
  33. .carousel .site-category .category .li-category a {
  34. position: relative;
  35. display: block;
  36. padding-left: 30px;
  37. height: 42px;
  38. line-height: 42px;
  39. color: #fff;
  40. font-size: 14px;
  41. }
  42. .icon-youjiantou {
  43. position: absolute;
  44. top: 12px;
  45. right: 20px;
  46. font-size: 16px;
  47. line-height: 16px;
  48. color: #e0e0e0;
  49. }
  50. .li-category a:hover {
  51. background-color: #ff6700;
  52. }
  53. /* 轮播图下4块小格 */
  54. .carousel .carousel_bottom {
  55. width: 1240px;
  56. height: 170px;
  57. /* background-color: pink; */
  58. margin-top: 14px;
  59. margin-left: -14px;
  60. display: flex;
  61. }
  62. .carousel .carousel_bottom .six {
  63. width: 234px;
  64. /* background-color: #b0b0b0; */
  65. float: left;
  66. margin-left: 14px;
  67. }
  68. .carousel .carousel_bottom .three {
  69. width: 978px;
  70. /* background-color: antiquewhite; */
  71. float: right;
  72. margin-left: 14px;
  73. }
  74. .carousel .carousel_bottom .three ul {
  75. display: flex;
  76. }
  77. .carousel .carousel_bottom .three li {
  78. margin-left: 15px;
  79. float: left;
  80. width: 316px;
  81. height: 170px;
  82. /* background-color: yellow; */
  83. }
  84. .carousel .carousel_bottom .three li img{
  85. display: block;
  86. width: 316px;
  87. height: 170px;
  88. }
  89. .carousel .carousel_bottom .three .first {
  90. margin-left: 0;
  91. }
  92. /* 轮播图下的六块 */
  93. .carousel_bottom .six {
  94. margin-left: 14px;
  95. min-height: 1px;
  96. }
  97. .carousel_bottom .six ul {
  98. float: left;
  99. margin: 0;
  100. padding: 3px;
  101. list-style-type: none;
  102. font-size: 12px;
  103. text-align: left;
  104. background-color: #5f5750;
  105. }
  106. .carousel_bottom .six .six_li li {
  107. position: relative;
  108. float: left;
  109. width: 76px;
  110. height: 82px;
  111. padding: 0 3px;
  112. }
  113. .carousel_bottom .six .six_li li a {
  114. display: block;
  115. padding-top: 18px;
  116. color: #fff;
  117. opacity: .7;
  118. transition: opacity .2s;
  119. text-align: center;
  120. }
  121. .carousel_bottom .six .six_li li a:hover {
  122. opacity: 1;
  123. }
  124. .carousel_bottom .six .six_li li img {
  125. display: block;
  126. width: 24px;
  127. height: 24px;
  128. margin: 0 auto 4px;
  129. }

代码过长不全,如果需要完整代码私信我

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/353525
推荐阅读
相关标签
  

闽ICP备14008679号