Blogger Information
Blog 14
fans 0
comment 0
visits 23783
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
快速搭建出淘宝网PC端首页框架
逍遥php
Original
427 people have browsed it

快速搭建出淘宝网PC端首页框架

demo.html

  1. <div class="wrap">
  2. <!-- 1.头部 -->
  3. <header>
  4. <!-- 1.顶部导航 -->
  5. <div class="top">
  6. <div class="content"></div>
  7. </div>
  8. <!-- 2.快速入口 -->
  9. <div class="entry">
  10. <div class="content">
  11. <div class="item logo"></div>
  12. <div class="item"></div>
  13. <div class="item"></div>
  14. <div class="item"></div>
  15. <div class="item"></div>
  16. <div class="item"></div>
  17. </div>
  18. </div>
  19. </header>
  20. <!-- 主体 -->
  21. <main>
  22. <!-- 1.搜索框 -->
  23. <div class="search">
  24. <div class="item logo"></div>
  25. <div class="item input"></div>
  26. <div class="item ewm"></div>
  27. </div>
  28. <!-- 2.导航区 -->
  29. <div class="navs">
  30. <!-- 1.左侧分类 -->
  31. <div class="cate"></div>
  32. <!-- 2.在侧轮播图与用户信息 -->
  33. <div class="user">
  34. <!-- 1.顶部导航 -->
  35. <div class="user-top"></div>
  36. <!-- 左侧轮播图 -->
  37. <div class="slider"></div>
  38. <!-- 右侧用户信息 -->
  39. <div class="user-info"></div>
  40. </div>
  41. </div>
  42. <!-- 3.标题区 -->
  43. <div class="title">
  44. <h2>猜你喜欢</h2>
  45. <span class="tag">个性推荐</span>
  46. </div>
  47. <!-- 4.商品列表 -->
  48. <div class="list">
  49. <div class="item">
  50. <a href=""><img src="" alt=""></a>
  51. <div class="detail">
  52. <div class="desc">商品描述</div>
  53. <div class="price">105</div>
  54. </div>
  55. </div>
  56. <div class="item">
  57. <a href=""><img src="" alt=""></a>
  58. <div class="detail">
  59. <div class="desc">商品描述</div>
  60. <div class="price">105</div>
  61. </div>
  62. </div>
  63. <div class="item">
  64. <a href=""><img src="" alt=""></a>
  65. <div class="detail">
  66. <div class="desc">商品描述</div>
  67. <div class="price">105</div>
  68. </div>
  69. </div>
  70. <div class="item">
  71. <a href=""><img src="" alt=""></a>
  72. <div class="detail">
  73. <div class="desc">商品描述</div>
  74. <div class="price">105</div>
  75. </div>
  76. </div>
  77. <div class="item">
  78. <a href=""><img src="" alt=""></a>
  79. <div class="detail">
  80. <div class="desc">商品描述</div>
  81. <div class="price">105</div>
  82. </div>
  83. </div>
  84. </div>
  85. </main>
  86. </div>

pc.css

  1. * {
  2. margin: 0;
  3. padding: 0;
  4. box-sizing: border-box;
  5. }
  6. body {
  7. min-height: 2000px;
  8. }
  9. /* 头部:导航 */
  10. .wrap header .top {
  11. width: 100vw;
  12. height: 36px;
  13. background-color: yellowgreen;
  14. }
  15. .wrap header .top .content {
  16. width: 1190px;
  17. height: inherit;
  18. background-color: wheat;
  19. margin: auto;
  20. }
  21. /* 头部:快速入口 */
  22. .wrap header .entry {
  23. height: 100px;
  24. padding: 15px;
  25. /* background-color: #ccc; */
  26. }
  27. .wrap header .entry .content {
  28. max-width: 1190px;
  29. min-width: 940px;
  30. height: inherit;
  31. background-color: cyan;
  32. margin: auto;
  33. display: grid;
  34. grid-template-columns: 80px repeat(5, 1fr);
  35. grid-auto-rows: 80px;
  36. gap: 10px;
  37. padding: 10px;
  38. }
  39. .wrap header .entry .content .item {
  40. background-color: lawngreen;
  41. border-radius: 15px;
  42. }
  43. /* 主体 */
  44. .wrap main {
  45. max-width: 1190px;
  46. min-width: 940px;
  47. min-height: 1000px;
  48. padding: 20px;
  49. background-color: lightblue;
  50. margin: 20px auto;
  51. }
  52. /* 搜索框 */
  53. .wrap main .search {
  54. height: 88px;
  55. display: grid;
  56. grid-template-columns: 190px 1fr 90px;
  57. gap: 10px;
  58. /* 粘性定位 */
  59. position: sticky;
  60. top: 0;
  61. }
  62. .wrap main .search .item {
  63. background-color: lightcoral;
  64. }
  65. /* 主体导航区 */
  66. main .navs {
  67. height: 423px;
  68. margin: 20px;
  69. display: grid;
  70. grid-template-columns: 270px 1fr;
  71. gap: 10px;
  72. }
  73. main .navs > * {
  74. background-color: lightcyan;
  75. }
  76. main .navs .user {
  77. display: grid;
  78. grid-template-columns: 564px 1fr;
  79. grid-template-rows: 42px 1fr;
  80. gap: 10px;
  81. }
  82. main .navs .user > * {
  83. background-color: lavender;
  84. }
  85. main .navs > .user .user-top {
  86. grid-column: span 2;
  87. }
  88. /* 主体标题区 */
  89. main .title {
  90. background-color: blueviolet;
  91. display: flex;
  92. place-items: center;
  93. }
  94. main .title .tag {
  95. background: linear-gradient(to left, orangered, yellow);
  96. color: white;
  97. border-radius: 5px;
  98. padding: 0 5px;
  99. margin-left: 6px;
  100. cursor: default;
  101. }
  102. /* 主体:商品列表 */
  103. main .list {
  104. margin: 20px 0;
  105. display: grid;
  106. grid-template-columns: repeat(3, 1fr);
  107. grid-auto-rows: 172px;
  108. gap: 10px;
  109. }
  110. main .list .item {
  111. background-color: lightpink;
  112. border-radius: 6px;
  113. display: grid;
  114. grid-template-columns: 150px 1fr;
  115. gap: 10px;
  116. padding: 10px;
  117. }
  118. main .list .item > * {
  119. background-color: aliceblue;
  120. border-radius: 6px;
  121. }
  122. main .list .item img {
  123. width: 100%;
  124. border-radius: 6px;
  125. }
  126. main .list .item .detail {
  127. display: grid;
  128. grid-template-rows: 1fr 25px;
  129. padding: 10px;
  130. place-content: space-between;
  131. }
  132. main .list .item .detail {
  133. background-color: aqua;
  134. }
  135. /* 媒体查询 */
  136. @media (max-width: 940px) {
  137. .wrap header .entry .content {
  138. grid-template-columns: 80px repeat(4, 1fr);
  139. }
  140. main .list {
  141. grid-template-columns: repeat(2, 1fr);
  142. }
  143. main .navs {
  144. grid-template-columns: 1fr;
  145. }
  146. main .navs .cate {
  147. display: none;
  148. }
  149. }

效果图展示

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