博客列表 >仿某商城手机端页眉页脚代码实例

仿某商城手机端页眉页脚代码实例

酿酒的人ァ
酿酒的人ァ原创
2021年03月27日 10:14:21635浏览

html代码如下

  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <link rel="stylesheet" href="static/icon-font/iconfont.css" />
  8. <link rel="stylesheet" href="static/css/index.css" />
  9. <title>Document</title>
  10. </head>
  11. <body>
  12. <header>
  13. <!-- 小导航图标 -->
  14. <div class="menu iconfont icon-menu"></div>
  15. <!-- 搜索框 -->
  16. <div class="search">
  17. <div class="logo">JD</div>
  18. <div class="suosuo iconfont icon-search"></div>
  19. <input type="text" class="word" value="蛋糕" />
  20. </div>
  21. <a href="" class="login">登陆</a>
  22. </header>
  23. <main>neiron</main>
  24. <footer>
  25. <div>
  26. <div class="iconfont icon-home"></div>
  27. <span>首页</span>
  28. </div>
  29. <div>
  30. <div class="iconfont icon-layers"></div>
  31. <span>分类</span>
  32. </div>
  33. <div>
  34. <div class="iconfont icon-shopping-cart"></div>
  35. <span>购物车</span>
  36. </div>
  37. <div>
  38. <div class="iconfont icon-user"></div>
  39. <span>我的</span>
  40. </div>
  41. </footer>
  42. </body>
  43. </html>

css代码如下

  1. /* 导入公共初始化样式表 */
  2. @import "reset.css";
  3. /* 头部开始 */
  4. header {
  5. display: flex;
  6. align-items: center;
  7. background-color: #e43130;
  8. color: white;
  9. height: 4.4rem;
  10. position: fixed;
  11. top: 0;
  12. left: 0;
  13. right: 0;
  14. z-index: 100;
  15. font-size: 1.4rem;
  16. }
  17. header .menu {
  18. text-align: center;
  19. flex: 1;
  20. font-size: 2.5rem;
  21. }
  22. header .search {
  23. flex: 6;
  24. padding: 0.5rem;
  25. background-color: #fff;
  26. border-radius: 3rem;
  27. display: flex;
  28. }
  29. header .search .logo {
  30. color: #e43130;
  31. flex: 0 1 4rem;
  32. font-size: 2rem;
  33. text-align: center;
  34. line-height: 2rem;
  35. }
  36. header .search .suosuo {
  37. color: #ccc;
  38. flex: 0 1 2em;
  39. border-left: 1px solid;
  40. text-align: center;
  41. line-height: 2rem;
  42. }
  43. header .search .word {
  44. flex: auto;
  45. border: none;
  46. outline: none;
  47. color: #aaa;
  48. }
  49. header .login {
  50. color: #fff;
  51. text-align: center;
  52. flex: 1;
  53. }
  54. /* 头部结束 */
  55. /* 内容区暂定 */
  56. main {
  57. position: absolute;
  58. top: 4.4rem;
  59. bottom: 4.4rem;
  60. left: 0;
  61. right: 0;
  62. font-size: 1.4rem;
  63. }
  64. /* 底部开始 */
  65. footer {
  66. display: flex;
  67. justify-content: space-around;
  68. align-items: center;
  69. color: #666;
  70. background-color: #fafafa;
  71. box-shadow: 0 0 3px #999;
  72. height: 4.4rem;
  73. position: fixed;
  74. bottom: 0;
  75. left: 0;
  76. right: 0;
  77. z-index: 100;
  78. font-size: 1.6rem;
  79. }
  80. footer div {
  81. display: flex;
  82. flex-flow: column nowrap;
  83. align-items: center;
  84. }
  85. footer div .iconfont {
  86. font-size: 2.4rem;
  87. }
  88. footer div .span {
  89. font-size: 1rem;
  90. }
  91. /* 底部结束 */

效果如下

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议