博客列表 >PC淘宝首页

PC淘宝首页

时间在渗透
时间在渗透原创
2022年11月01日 20:03:23353浏览

效果图

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. <title>PC端淘宝</title>
  8. <link rel="stylesheet" href="static/css/taobao-pc.css">
  9. </head>
  10. <body>
  11. <!-- 顶部导航栏 -->
  12. <div class="topbar">
  13. <div class="container">
  14. <ul class="topbar-ul">
  15. <li class="dropdown topbar-item-region">
  16. <div class="dropdown-selected">
  17. <span>中国大陆</span>
  18. <span class="iconfont">&#xe7b2;</span>
  19. </div>
  20. <ul class="dropdown-list">
  21. <li>全球</li>
  22. <li>中国大陆</li>
  23. <li>中国香港</li>
  24. <li>中国台湾</li>
  25. <li>中国澳门</li>
  26. <li>韩国</li>
  27. <li>马来西亚</li>
  28. <li>澳大利亚</li>
  29. <li>新加波</li>
  30. <li>新西兰</li>
  31. </ul>
  32. </li>
  33. <li><a style="color: #f40;">亲,请先登录</a><a>免费注册</a></li>
  34. <li><a>手机淘宝</a></li>
  35. <li><a>网页无障碍</a></li>
  36. </ul>
  37. <ul class="topbar-ul">
  38. <li><a>我的淘宝</a></li>
  39. <li><a><i class="iconfont" style="color: #f40;">&#xe70b;</i> 购物车</a></li>
  40. <li><a>收藏夹</a></li>
  41. </ul>
  42. </div>
  43. </div>
  44. <!-- 快速入口 -->
  45. <div class="entry">
  46. <div class="container">
  47. <div class="item place-text" place-text="图标"></div>
  48. <div class="item place-text" place-text="类目1"></div>
  49. <div class="item place-text" place-text="类目2"></div>
  50. <div class="item place-text" place-text="类目3"></div>
  51. <div class="item place-text" place-text="类目4"></div>
  52. <div class="item place-text" place-text="类目5"></div>
  53. </div>
  54. </div>
  55. <!-- 主体部分 -->
  56. <div class="container main">
  57. <!-- 头部 -->
  58. <div class="header">
  59. <div class="logo place-text" place-text="LOGO"></div>
  60. <div class="search place-text" place-text="搜索框"></div>
  61. <div class="qrcode place-text" place-text="二维码"></div>
  62. </div>
  63. <!-- 导航/轮播/用户信息 -->
  64. <div class="screen">
  65. <div class="screen-menu place-text" place-text="分类导航"></div>
  66. <div class="screen-main">
  67. <div class="screen-nav place-text" place-text="快捷导航"></div>
  68. <div class="screen-slide place-text" place-text="轮播图"></div>
  69. <div class="screen-user place-text" place-text="用户信息"></div>
  70. </div>
  71. </div>
  72. <!-- 商品列表 -->
  73. <div class="list">
  74. <div class="title">
  75. <h2>猜你喜欢</h2>
  76. <label>个性推荐</label>
  77. </div>
  78. <div class="list-row">
  79. <a class="item">
  80. <div class="pic place-text" place-text="封面图"></div>
  81. <div class="info">
  82. <div class="desc">
  83. <div class="info-title">商品描述商品描述商品描述商品描述</div>
  84. <div class="info-tag"><label class="tag-yfx">运送费险</label></div>
  85. </div>
  86. <div class="price"><em>¥</em> 59.9</div>
  87. </div>
  88. </a>
  89. <a class="item">
  90. <div class="pic place-text" place-text="封面图"></div>
  91. <div class="info">
  92. <div class="desc">
  93. <div class="info-title"><label class="tag-hot">HOT</label>商品描述商品描述商品描述商品描述</div>
  94. <div class="info-tag"><label class="tag-yfx">运送费险</label></div>
  95. </div>
  96. <div class="price"><em>¥</em> 59.9</div>
  97. </div>
  98. </a>
  99. <a class="item">
  100. <div class="pic place-text" place-text="封面图"></div>
  101. <div class="info">
  102. <div class="desc">
  103. <div class="info-title"><label class="tag-hot">天猫双11</label>商品描述商品描述商品描述商品描述</div>
  104. <div class="info-tag"><label class="tag-yfx">运送费险</label></div>
  105. </div>
  106. <div class="price"><em>¥</em> 59.9</div>
  107. </div>
  108. </a>
  109. <a class="item">
  110. <div class="pic place-text" place-text="封面图"></div>
  111. <div class="info">
  112. <div class="desc">
  113. <div class="info-title"><label class="tag-hot">HOT</label>商品描述商品描述商品描述商品描述</div>
  114. </div>
  115. <div class="price"><em>¥</em> 59.9</div>
  116. </div>
  117. </a>
  118. <a class="item">
  119. <div class="pic place-text" place-text="封面图"></div>
  120. <div class="info">
  121. <div class="desc">
  122. <div class="info-title">商品描述商品描述商品描述商品描述</div>
  123. <div class="info-tag"><label class="tag-yfx">运送费险</label></div>
  124. </div>
  125. <div class="price"><em>¥</em> 59.9</div>
  126. </div>
  127. </a>
  128. <a class="item">
  129. <div class="pic place-text" place-text="封面图"></div>
  130. <div class="info">
  131. <div class="desc">
  132. <div class="info-title"><label class="tag-hot">天猫双11</label>商品描述商品描述商品描述商品描述</div>
  133. <div class="info-tag"><label class="tag-yfx">运送费险</label></div>
  134. </div>
  135. <div class="price"><em>¥</em> 59.9</div>
  136. </div>
  137. </a>
  138. <a class="item">
  139. <div class="pic place-text" place-text="封面图"></div>
  140. <div class="info">
  141. <div class="desc">
  142. <div class="info-title"><label class="tag-hot">HOT</label>商品描述商品描述商品描述商品描述</div>
  143. <div class="info-tag"><label class="tag-yfx">运送费险</label></div>
  144. </div>
  145. <div class="price"><em>¥</em> 59.9</div>
  146. </div>
  147. </a>
  148. <a class="item">
  149. <div class="pic place-text" place-text="封面图"></div>
  150. <div class="info">
  151. <div class="desc">
  152. <div class="info-title"><label class="tag-hot">天猫双11</label>商品描述商品描述商品描述商品描述</div>
  153. <div class="info-tag"><label class="tag-yfx">运送费险</label></div>
  154. </div>
  155. <div class="price"><em>¥</em> 59.9</div>
  156. </div>
  157. </a>
  158. <a class="item">
  159. <div class="pic place-text" place-text="封面图"></div>
  160. <div class="info">
  161. <div class="desc">
  162. <div class="info-title"><label class="tag-hot">HOT</label>商品描述商品描述商品描述商品描述</div>
  163. </div>
  164. <div class="price"><em>¥</em> 59.9</div>
  165. </div>
  166. </a>
  167. </div>
  168. </div>
  169. </div>
  170. <div class="footer">
  171. <div class="container">
  172. <p style="text-align: center;">底部版权信息</p>
  173. </div>
  174. </div>
  175. </body>
  176. </html>

CSS

  1. /* 重置基础样式 */
  2. * {
  3. margin: 0;
  4. padding: 0;
  5. box-sizing: border-box;
  6. }
  7. body {
  8. font-size: 14px;
  9. color: #333;
  10. background-color: #f6f6f6;
  11. }
  12. a {
  13. color: #333;
  14. cursor: pointer;
  15. text-decoration: none;
  16. }
  17. a:hover {
  18. color: #FF5000;
  19. transition: all .3s;
  20. }
  21. li {
  22. list-style: none;
  23. }
  24. img {
  25. border: none;
  26. width: 100%;
  27. }
  28. i,em,cite {
  29. font-style: normal;
  30. }
  31. /* 占位文本 */
  32. .place-text {
  33. position: relative;
  34. }
  35. .place-text:before{
  36. position: absolute;
  37. content: attr(place-text);
  38. top: 50%;
  39. left:50%;
  40. transform: translate(-50%, -50%);
  41. color: #bbb;
  42. }
  43. /* 全局容器宽度适应 */
  44. .container {
  45. margin: 0 auto;
  46. padding: 0 20px;
  47. }
  48. @media (min-width: 768px) {
  49. .container {
  50. width: 750px;
  51. }
  52. }
  53. @media (min-width: 992px) {
  54. .container {
  55. width: 970px;
  56. }
  57. }
  58. @media (min-width: 1200px) {
  59. .container {
  60. width: 1170px;
  61. }
  62. }
  63. /* 图标字体 */
  64. @font-face {
  65. font-family: 'iconfont'; /* Project id 3738571 */
  66. src: url('https://at.alicdn.com/t/c/font_3738571_w9b16dc3ye.woff2?t=1667204474667') format('woff2'),
  67. url('https://at.alicdn.com/t/c/font_3738571_w9b16dc3ye.woff?t=1667204474667') format('woff'),
  68. url('https://at.alicdn.com/t/c/font_3738571_w9b16dc3ye.ttf?t=1667204474667') format('truetype');
  69. }
  70. .iconfont {
  71. font-family: 'iconfont' !important;
  72. font-size: 16px;
  73. font-style: normal;
  74. }
  75. /* 顶部栏 */
  76. .topbar {
  77. height: 35px;
  78. background-color: #f5f5f5;
  79. border-bottom: 1px solid #eee;
  80. }
  81. .topbar>.container {
  82. display: flex;
  83. flex-flow: row nowrap;
  84. place-content: space-between;
  85. }
  86. .topbar .topbar-ul>li{
  87. display: inline-block;
  88. line-height: 35px;
  89. font-size: 12px;
  90. }
  91. .topbar .topbar-ul>li+li {
  92. margin-left: 10px;
  93. }
  94. .topbar .topbar-ul>li .iconfont {
  95. font-size: 12px;
  96. }
  97. .topbar .topbar-ul>li>a+a {
  98. margin-left: 8px;
  99. }
  100. /* 下拉菜单 */
  101. .dropdown {
  102. position: relative;
  103. z-index: 9;
  104. }
  105. /* 下拉默认选中展示的文字 */
  106. .dropdown-selected {
  107. position: relative;
  108. padding: 0 20px 0 6px;
  109. cursor: pointer;
  110. }
  111. /* 下拉右侧小箭头 */
  112. .dropdown-selected .iconfont {
  113. position: absolute;
  114. right: 0;
  115. font-size: 12px;
  116. }
  117. /* 下拉菜单列表 */
  118. ul.dropdown-list {
  119. display: none;
  120. position: absolute;
  121. top: 35px;
  122. left: 0;
  123. background-color: #fff;
  124. padding: 8px 0;
  125. height: 240px;
  126. overflow-x: hidden;
  127. }
  128. ul.dropdown-list>li {
  129. cursor: pointer;
  130. width: 150px;
  131. line-height: 28px;
  132. padding: 0 6px;
  133. }
  134. ul.dropdown-list>li:hover {
  135. background-color: #f4f4f4;
  136. }
  137. /* 当鼠标碰到高亮背景色 */
  138. .dropdown:hover .dropdown-selected {
  139. background-color: #fff;
  140. }
  141. .dropdown:hover ul.dropdown-list{
  142. display: block;
  143. }
  144. /*快速入口*/
  145. .entry {
  146. background-color: #ff72b5;
  147. padding: 15px 0;
  148. height: 100px;
  149. }
  150. .entry>.container {
  151. display: grid;
  152. grid-template-columns: 100px repeat(5, 1fr);
  153. grid-auto-rows:70px;
  154. gap: 10px;
  155. }
  156. .entry .item {
  157. border-radius:10px;
  158. background-color: #fff;
  159. }
  160. /* 主体 */
  161. .main {
  162. background-color: #fff;
  163. padding:30px;
  164. margin-bottom: 20px;
  165. }
  166. /*头部区*/
  167. .header {
  168. /*粘性定位*/
  169. position: static;
  170. top: 0;
  171. display: grid;
  172. grid-template-columns: 200px 12fr 90px;
  173. height: 90px;
  174. gap: 30px;
  175. margin-bottom: 20px;
  176. }
  177. .header>* {
  178. background-color: #eee;
  179. text-align: center;
  180. line-height: 90px;
  181. }
  182. /* 导航/轮播/用户信息 */
  183. .screen {
  184. display: grid;
  185. grid-template-columns: 270px 1fr;
  186. gap: 15px;
  187. height: 360px;
  188. margin-bottom: 20px;
  189. }
  190. .screen-menu,
  191. .screen-main > .screen-nav,
  192. .screen-main > .screen-slide,
  193. .screen-main > .screen-user{
  194. background-color: #eee;
  195. border-radius: 10px;
  196. }
  197. .screen-main {
  198. display: grid;
  199. grid-template-columns: 1.5fr 1fr;
  200. grid-template-rows: 40px 1fr;
  201. gap: 10px;
  202. }
  203. .screen-nav {
  204. grid-column: span 2;
  205. }
  206. /* 列表标题栏 */
  207. .title {
  208. display: flex;
  209. place-items: center;
  210. margin-bottom: 20px;
  211. }
  212. .title>h2 {
  213. color: #000;
  214. font-weight: bold;
  215. font-size: 24px;
  216. }
  217. .title>label {
  218. background: linear-gradient(to left, orangered, orange);
  219. color: #fff;
  220. border-radius: 5px;
  221. padding: 0 5px;
  222. margin-left: 6px;
  223. }
  224. /* 商品列表 */
  225. .list-row {
  226. display: grid;
  227. grid-template-columns: repeat(3, 1fr);
  228. grid-auto-rows: 175px;
  229. gap: 15px;
  230. }
  231. .list-row > .item {
  232. display: grid;
  233. grid-template-columns: 150px 1fr;
  234. gap: 10px;
  235. background-color: #f7f9fa;
  236. border: 1px solid #f7f9fa;
  237. border-radius: 10px;
  238. padding: 10px;
  239. }
  240. .list-row > .item:hover {
  241. background-color: #fff;
  242. border-color: #ff915e;
  243. box-shadow: 0 8px 12px 0 rgb(255 80 0 / 6%);
  244. }
  245. .list-row > .item > .pic {
  246. background-color: rgb(0 0 0 / 6%);
  247. border-radius: 5px;
  248. }
  249. .list-row > .item > .pic > img {
  250. width: 100%;
  251. border-radius: 5px;
  252. }
  253. .list-row > .item > .info {
  254. display: grid;
  255. grid-template-rows: 1fr 25px;
  256. place-content: space-between;
  257. line-height: 1.5;
  258. padding: 10px 0;
  259. }
  260. .list-row > .item .info-title {
  261. color: #333;
  262. font-size: 16px;
  263. overflow: hidden;
  264. max-height: 46px;
  265. }
  266. .list-row >.item .price {
  267. font-size: 22px;
  268. color: #ff5000;
  269. }
  270. .list-row > .item .tag-hot {
  271. background: linear-gradient(to left, orangered, orange);
  272. color: #fff;
  273. border-radius: 3px;
  274. padding: 0 5px;
  275. margin-right: 6px;
  276. font-size: 12px;
  277. }
  278. .list-row > .item .tag-yfx {
  279. color: #FF5000;
  280. border: 1px solid #FAB596;
  281. background: #fff;
  282. border-radius: 3px;
  283. padding: 0 5px;
  284. margin-right: 6px;
  285. font-size: 12px;
  286. }
  287. .footer {
  288. padding: 20px 0;
  289. background-color: #fff;
  290. }
  291. @media (max-width: 1200px) {
  292. .list-row > .item {
  293. grid-template-columns: 120px 1fr;
  294. }
  295. }
  296. @media (max-width: 992px) {
  297. .entry>.container {
  298. grid-template-columns: 100px repeat(4, 1fr);
  299. }
  300. .entry .item:last-of-type {
  301. display: none;
  302. }
  303. .screen {
  304. grid-template-columns: 1fr;
  305. }
  306. .screen-menu {
  307. display: none;
  308. }
  309. .list-row {
  310. grid-template-columns: repeat(2, 1fr);
  311. }
  312. }
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议