Blogger Information
Blog 37
fans 0
comment 1
visits 28506
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
html+ css grid布局 淘宝静态首页排版案例
kong
Original
340 people have browsed it

淘宝静态首页排版

  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. <title>淘宝移动端布局</title>
  8. </head>
  9. <body>
  10. <header class="header">
  11. <a href=""><img src="0210/images/taobao.png" alt=""></a>
  12. <a href="" class="search">
  13. <div class="link-wrapper">
  14. <span class="placeholder">寻找宝贝店铺</span>
  15. <span class="search-btn">搜索</span>
  16. </div>
  17. </a>
  18. <a href=""><img class="signIn"
  19. src="https://gw.alicdn.com/imgextra/i4/O1CN01ftum4629SHP6bCqTm_!!6000000008066-2-tps-99-99.png"></a>
  20. </header>
  21. <main class="main">
  22. <ul class="navs">
  23. <li class="item">
  24. <a href=""><img src="0210/images/navs/tmxb.webp" alt="" /></a>
  25. <a href="">天猫新品</a>
  26. </li>
  27. <li class="item">
  28. <a href=""><img src="0210/images/navs/jrbk.webp" alt="" /></a>
  29. <a href="">今日爆款</a>
  30. </li>
  31. <li class="item">
  32. <a href=""><img src="0210/images/navs/tmgj.webp" alt="" /></a>
  33. <a href="">天猫国际</a>
  34. </li>
  35. <li class="item">
  36. <a href=""><img src="0210/images/navs/fzlx.webp" alt="" /></a>
  37. <a href="">飞猪旅行</a>
  38. </li>
  39. <li class="item">
  40. <a href=""><img src="0210/images/navs/tmcx.webp" alt="" /></a>
  41. <a href="">天猫超市</a>
  42. </li>
  43. <li class="item">
  44. <a href=""><img src="0210/images/navs/tbch.webp" alt="" /></a>
  45. <a href="">淘宝吃货</a>
  46. </li>
  47. <li class="item">
  48. <a href=""><img src="0210/images/navs/sqk.webp" alt="" /></a>
  49. <a href="">省钱卡</a>
  50. </li>
  51. <li class="item">
  52. <a href=""><img src="0210/images/navs/ltjb.webp" alt="" /></a>
  53. <a href="">领淘金币</a>
  54. </li>
  55. <li class="item">
  56. <a href=""><img src="0210/images/navs/alpm.webp" alt="" /></a>
  57. <a href="">阿里拍卖</a>
  58. </li>
  59. <li class="item">
  60. <a href=""><img src="0210/images/navs/fl.webp" alt="" /></a>
  61. <a href="">分类</a>
  62. </li>
  63. </ul>
  64. <ul class="entry">
  65. <li class="item">
  66. <div class="title">
  67. <h3>聚划算</h3>
  68. <span
  69. style="color: rgb(255, 255, 255); font-size: 11px; background-color: rgb(255, 66, 0);">品牌折扣</span>
  70. </div>
  71. <a href="">
  72. <img class="one" src="0210/images/items/item-1.webp" alt="" />
  73. </a>
  74. <a href=""><img src="0210/images/items/item-2.webp" alt="" class="tow" /></a>
  75. </li>
  76. <li class="item">
  77. <div class="title">
  78. <h3>天天特卖</h3>
  79. <span
  80. style="color: rgb(255, 255, 255); font-size: 12px; background-color: rgb(255, 66, 0);">1元秒杀</span>
  81. </div>
  82. <a href=""><img src="0210/images/items/item-3.webp" alt="" class="one" /></a>
  83. <a href=""><img src="0210/images/items/item-4.webp" alt="" class="tow" /></a>
  84. </li>
  85. <li class="item">
  86. <div class="title">
  87. <h3>有好货</h3>
  88. <span style="background-color: deepskyblue">好口碑</span>
  89. </div>
  90. <a href=""><img src="0210/images/items/item-5.webp" alt="" class="one" /></a>
  91. <a href=""><img src="0210/images/items/item-6.webp" alt="" class="tow" /></a>
  92. </li>
  93. <li class="item">
  94. <div class="title">
  95. <h3>每日好店</h3>
  96. <span style="background-color: orange">特色</span>
  97. </div>
  98. <a href=""><img src="0210/images/items/item-7.webp" alt="" class="one" /></a>
  99. <a href=""><img src="0210/images/items/item-8.webp" alt="" class="tow" /></a>
  100. </li>
  101. </ul>
  102. <ul class="list">
  103. <li class="item">
  104. <!-- 图片 -->
  105. <a href=""><img src="0210/images/items/item-9.webp" alt="" /></a>
  106. <!-- 描述 -->
  107. <div class="desc">
  108. <a href="">商品简介商品简介商品简介商品简介商品简介</a>
  109. <div class="price">
  110. <span class="iconfont icon-renminbi_o">¥ 14.9</span>
  111. <span>123人已购买</span>
  112. </div>
  113. </div>
  114. </li>
  115. <li class="item">
  116. <a href=""><img src="0210/images/items/item-10.webp" alt="" /></a>
  117. <div class="desc">
  118. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  119. <div class="price">
  120. <span class="iconfont icon-renminbi_o">¥ 288</span>
  121. <span>123人已购买</span>
  122. </div>
  123. </div>
  124. </li>
  125. <li class="item">
  126. <a href=""><img src="0210/images/items/item-11.webp" alt="" /></a>
  127. <div class="desc">
  128. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  129. <div class="price">
  130. <span class="iconfont icon-renminbi_o">¥ 288</span>
  131. <span>123人已购买</span>
  132. </div>
  133. </div>
  134. </li>
  135. <li class="item">
  136. <a href=""><img src="0210/images/items/item-12.webp" alt="" /></a>
  137. <div class="desc">
  138. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  139. <div class="price">
  140. <span class="iconfont icon-renminbi_o">¥ 288</span>
  141. <span>123人已购买</span>
  142. </div>
  143. </div>
  144. </li>
  145. <li class="item">
  146. <a href=""><img src="0210/images/items/item-13.webp" alt="" /></a>
  147. <div class="desc">
  148. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  149. <div class="price">
  150. <span class="iconfont icon-renminbi_o">¥ 288</span>
  151. <span>123人已购买</span>
  152. </div>
  153. </div>
  154. </li>
  155. <li class="item">
  156. <a href=""><img src="0210/images/items/item-14.webp" alt="" /></a>
  157. <div class="desc">
  158. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  159. <div class="price">
  160. <span class="iconfont icon-renminbi_o">¥ 288</span>
  161. <span>123人已购买</span>
  162. </div>
  163. </div>
  164. </li>
  165. <li class="item">
  166. <a href=""><img src="0210/images/items/item-15.webp" alt="" /></a>
  167. <div class="desc">
  168. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  169. <div class="price">
  170. <span class="iconfont icon-renminbi_o">¥ 288</span>
  171. <span>123人已购买</span>
  172. </div>
  173. </div>
  174. </li>
  175. <li class="item">
  176. <a href=""><img src="0210/images/items/item-16.webp" alt="" /></a>
  177. <div class="desc">
  178. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  179. <div class="price">
  180. <span class="iconfont icon-renminbi_o">¥ 288</span>
  181. <span>123人已购买</span>
  182. </div>
  183. </div>
  184. </li>
  185. <li class="item">
  186. <a href=""><img src="0210/images/items/item-17.webp" alt="" /></a>
  187. <div class="desc">
  188. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  189. <div class="price">
  190. <span class="iconfont icon-renminbi_o">¥ 288</span>
  191. <span>123人已购买</span>
  192. </div>
  193. </div>
  194. </li>
  195. <li class="item">
  196. <a href=""><img src="0210/images/items/item-18.webp" alt="" /></a>
  197. <div class="desc">
  198. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  199. <div class="price">
  200. <span class="iconfont icon-renminbi_o">¥ 288</span>
  201. <span>123人已购买</span>
  202. </div>
  203. </div>
  204. </li>
  205. <li class="item">
  206. <a href=""><img src="0210/images/items/item-19.webp" alt="" /></a>
  207. <div class="desc">
  208. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  209. <div class="price">
  210. <span class="iconfont icon-renminbi_o">¥ 288</span>
  211. <span>123人已购买</span>
  212. </div>
  213. </div>
  214. </li>
  215. <li class="item">
  216. <a href=""><img src="0210/images/items/item-20.webp" alt="" /></a>
  217. <div class="desc">
  218. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  219. <div class="price">
  220. <span class="iconfont icon-renminbi_o">¥ 288</span>
  221. <span>123人已购买</span>
  222. </div>
  223. </div>
  224. </li>
  225. <li class="item">
  226. <a href=""><img src="0210/images/items/item-21.webp" alt="" /></a>
  227. <div class="desc">
  228. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  229. <div class="price">
  230. <span class="iconfont icon-renminbi_o">¥ 288</span>
  231. <span>123人已购买</span>
  232. </div>
  233. </div>
  234. </li>
  235. <li class="item">
  236. <a href=""><img src="0210/images/items/item-22.webp" alt="" /></a>
  237. <div class="desc">
  238. <a href="">商品描述商品描述商品描述商品描述商品描述</a>
  239. <div class="price">
  240. <span class="iconfont icon-renminbi_o">¥ 288</span>
  241. <span>123人已购买</span>
  242. </div>
  243. </div>
  244. </li>
  245. </ul>
  246. </main>
  247. <footer class="footer">
  248. <a href="">
  249. <span class="iconfont icon-gouwuche"></span>
  250. <span>首页</span>
  251. </a>
  252. <a href="">
  253. <span class="iconfont icon-gouwuche"></span>
  254. <span>购物车</span>
  255. </a>
  256. <a href="">
  257. <span class="iconfont icon-wode"></span>
  258. <span>我的淘宝</span>
  259. </a>
  260. </footer>
  261. </body>
  262. </html>
  1. * {
  2. padding: 0;
  3. margin: 0;
  4. box-sizing: border-box;
  5. }
  6. html {
  7. font-size: calc(100vw / 3.75);
  8. }
  9. body {
  10. font-size: .16rem;
  11. background-color: #f4f4f4;
  12. padding-bottom: .5rem;
  13. }
  14. a {
  15. text-decoration: none;
  16. }
  17. ul {
  18. list-style-type: none;
  19. }
  20. .header {
  21. position: fixed;
  22. width: 100%;
  23. top: 0;
  24. left: 0;
  25. z-index: 9;
  26. display: grid;
  27. grid-template-columns: .6rem 1fr .34rem;
  28. grid-auto-rows: .5rem;
  29. background-color: #f4f4f4;
  30. place-items: center stretch;
  31. padding: 0 .10rem;
  32. }
  33. .header img {
  34. max-width: 100%;
  35. display: block;
  36. }
  37. .search {
  38. padding: .02rem;
  39. border: 1px solid #ff5000;
  40. font-size: .14rem;
  41. margin: 0 .15rem;
  42. background-color: #fff;
  43. border-radius: .5rem;
  44. }
  45. .link-wrapper {
  46. display: flex;
  47. place-content: space-between;
  48. place-items: center;
  49. }
  50. .placeholder {
  51. color: #666;
  52. margin-left: .05rem;
  53. }
  54. .search-btn {
  55. width: .64rem;
  56. height: .32rem;
  57. line-height: .32rem;
  58. background: -webkit-linear-gradient(left, #FF8D0E, #FF5000);
  59. background: linear-gradient(to right, #FF8D0E, #FF5000);
  60. font-size: 0.14rem;
  61. color: #fff;
  62. text-align: center;
  63. border-radius: 0.16rem;
  64. }
  65. .main {
  66. margin-top: .6rem;
  67. }
  68. .navs {
  69. display: grid;
  70. grid-template-columns: repeat(5, 20%);
  71. grid-template-rows: repeat(2, 1fr);
  72. background-color: #fff;
  73. margin: 0 .1rem;
  74. font-size: .13rem;
  75. text-align: center;
  76. border-radius: .1rem;
  77. padding-bottom: .12rem;
  78. margin-bottom: .05rem;
  79. }
  80. .navs li>a img {
  81. display: block;
  82. max-width: 100%;
  83. }
  84. .navs li>a {
  85. display: block;
  86. color: #666;
  87. }
  88. .navs li>a:last-child {
  89. margin-top: .05rem;
  90. }
  91. .entry {
  92. border-radius: .1rem;
  93. margin: 0 0.1rem;
  94. display: grid;
  95. grid-template-columns: repeat(2, 50%);
  96. grid-template-rows: repeat(2, 0.92rem);
  97. gap: .01rem;
  98. overflow: hidden;
  99. }
  100. .entry>.item {
  101. position: relative;
  102. background-color: #fff;
  103. padding: .05rem;
  104. }
  105. .entry>.item .title {
  106. position: absolute;
  107. font-size: .12rem;
  108. left: .05rem;
  109. top: .05rem;
  110. display: flex;
  111. place-items: center;
  112. }
  113. .entry>.item .title span {
  114. color: #fff;
  115. padding: 0 .02rem;
  116. border-radius: 2px;
  117. margin-left: .03rem;
  118. }
  119. .entry>.item {
  120. display: flex;
  121. height: .92rem;
  122. place-items: flex-end;
  123. place-content: space-between;
  124. }
  125. .entry>.item .one {
  126. display: block;
  127. width: .6rem;
  128. height: .6rem;
  129. }
  130. .entry>.item .tow {
  131. display: block;
  132. width: .8rem;
  133. height: .8rem;
  134. }
  135. .footer {
  136. position: fixed;
  137. bottom: 0;
  138. width: 100%;
  139. left: 0;
  140. background-color: #fff;
  141. display: grid;
  142. grid-template-columns: repeat(3, 1fr);
  143. grid-auto-rows: .46rem;
  144. border-top: 1px solid #e7e7e7;
  145. border-bottom: 1px solid #f8f8f8;
  146. place-items: center;
  147. font-size: .12rem;
  148. }
  149. .list{
  150. display: grid;
  151. grid-template-columns: repeat(2,1fr);
  152. margin: .05rem 0.1rem;
  153. gap: .08rem;
  154. }
  155. .list > li{
  156. background-color: #fff;
  157. border-radius: .08rem;
  158. overflow: hidden;
  159. font-size: .13rem;
  160. }
  161. .list > li img{
  162. display: block;
  163. max-width: 100%;
  164. }
  165. .desc{
  166. padding: .1rem;
  167. }
  168. .desc a{
  169. display: block;
  170. line-height: 1.5;
  171. color: #333;
  172. height: .42rem;
  173. overflow: hidden;
  174. }
  175. .price{
  176. margin-top: .05rem;
  177. color: #999999;
  178. }
  179. .price .iconfont{
  180. font-size: .13rem;
  181. color: #ff5500;
  182. }
  183. .footer span.iconfont {
  184. display: block;
  185. width: .2rem;
  186. height: .2rem;
  187. background-color: #e7e7e7;
  188. margin: 0 auto;
  189. margin-bottom: .02rem;
  190. }
  191. .footer a {
  192. color: #666;
  193. }

效果图

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