Blogger Information
Blog 10
fans 0
comment 0
visits 5478
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
实战淘宝首页的基本整体架构:页眉,页脚,主体
土老帽
Original
785 people have browsed it

淘宝首面的基本整体架构

1.顶部+轮播图+导航

html代码
  1. <header>
  2. <!-- 顶部 -->
  3. <div class="top">
  4. <!-- logo -->
  5. <div class="logo iconfont icon-shejiaotubiao-08"></div>
  6. <!-- 搜索框 -->
  7. <div class="search">
  8. <div class="keys">
  9. <span class="iconfont icon-fangdajing"></span>
  10. <span>寻找宝贝店铺</span>
  11. </div>
  12. </div>
  13. </div>
  14. <!-- 轮播图 -->
  15. <div class="slider">
  16. <a href=""><img src="images/banner/banner1.jpg" alt="" /></a>
  17. </div>
  18. <!-- 导航组 -->
  19. <ul class="nav">
  20. <li class="item">
  21. <a href=""><img src="images/nav/nav6.png" alt="" /></a>
  22. <a href="">天猫新品</a>
  23. </li>
  24. <li class="item">
  25. <a href=""><img src="images/nav/nav3.png" alt="" /></a>
  26. <a href="">今日爆款</a>
  27. </li>
  28. <li class="item">
  29. <a href=""><img src="images/nav/nav1.png" alt="" /></a>
  30. <a href="">天猫超市</a>
  31. </li>
  32. <li class="item">
  33. <a href=""><img src="images/nav/nav2.png" alt="" /></a>
  34. <a href="">充值中心</a>
  35. </li>
  36. <li class="item">
  37. <a href=""><img src="images/nav/nav5.png" alt="" /></a>
  38. <a href="">机票酒店</a>
  39. </li>
  40. <li class="item">
  41. <a href=""><img src="images/nav/nav8.png" alt="" /></a>
  42. <a href="">金币庄园</a>
  43. </li>
  44. <li class="item">
  45. <a href=""><img src="images/nav/nav7.png" alt="" /></a>
  46. <a href="">阿里拍卖</a>
  47. </li>
  48. <li class="item">
  49. <a href=""><img src="images/nav/nav4.png" alt="" /></a>
  50. <a href="">分类</a>
  51. </li>
  52. <li class="item">
  53. <a href=""><img src="images/nav/nav7.png" alt="" /></a>
  54. <a href="">阿里拍卖</a>
  55. </li>
  56. <li class="item">
  57. <a href=""><img src="images/nav/nav4.png" alt="" /></a>
  58. <a href="">分类</a>
  59. </li>
  60. </ul>
  61. </header>
CSS代码
  1. header {
  2. position: relative;
  3. }
  4. header .top {
  5. width: 100vw;
  6. background-color: coral;
  7. position: fixed;
  8. top: 0;
  9. left: 0;
  10. right: 0;
  11. display: grid;
  12. grid-template-columns: 0.35rem 1fr;
  13. padding: 0.05rem;
  14. /* 调整显示层级 */
  15. z-index: 99;
  16. }
  17. header .top .logo {
  18. color: white;
  19. font-size: 0.25rem;
  20. }
  21. header .top .search {
  22. background-color: orangered;
  23. color: #eee;
  24. display: grid;
  25. place-content: center;
  26. border-radius: 0.05rem;
  27. font-size: small;
  28. }
  29. /* 轮播图,用图片代替 */
  30. header .slider {
  31. height: 1.25rem;
  32. position: absolute;
  33. top: 0.35rem;
  34. }
  35. header .slider img,
  36. header .nav img {
  37. width: 100%;
  38. height: 100%;
  39. }
  40. /* 导航组 */
  41. header .nav {
  42. background-color: #fff;
  43. position: absolute;
  44. top: calc(0.35rem + 1.25rem);
  45. display: grid;
  46. grid-template-columns: repeat(5, 1fr);
  47. font-size: 0.11rem;
  48. padding: 0.2rem 0.1rem;
  49. }
  50. header .nav .item {
  51. display: grid;
  52. place-items: center;
  53. padding: 0 0.05rem;
  54. }
  55. header .nav .item a {
  56. padding: 0 0.05rem;
  57. }
顶部-展示效果

2.主体

html代码

  1. <!-- 主体先预设高度:2000px -->
  2. <main style="height: 2000px">
  3. <!-- 中间内容 -->
  4. </main>

3.底部

html代码
  1. <footer>
  2. <div class="item active">
  3. <a href="" class="iconfont icon-shejiaotubiao-44"></a>
  4. </div>
  5. <div class="item">
  6. <a href="" class="iconfont icon-gouwuche"></a>
  7. <a href="">购物车</a>
  8. </div>
  9. <div class="item">
  10. <a href="" class="iconfont icon-wodetaobao"></a>
  11. <a href="">我的淘宝</a>
  12. </div>
  13. </footer>
CSS代码
  1. footer {
  2. width: 100vw;
  3. height: 0.46rem;
  4. background-color: #fff;
  5. position: fixed;
  6. bottom: 0;
  7. left: 0;
  8. right: 0;
  9. display: grid;
  10. grid-template-columns: repeat(3, 1fr);
  11. place-items: center;
  12. }
  13. footer .item {
  14. display: grid;
  15. place-items: center;
  16. }
  17. footer .item .iconfont {
  18. font-size: 0.2rem;
  19. }
  20. footer .item.active .iconfont {
  21. font-size: 0.36rem;
  22. color: coral;
  23. }

底部-展示效果

整体展示效果

Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post