博客列表 >仿京东商城首页

仿京东商城首页

搬砖来学php
搬砖来学php原创
2022年07月20日 02:06:17439浏览

  1. <!DOCTYPE html>
  2. <html lang="en">
  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="css/reset.css" />
  8. <link rel="stylesheet" href="icon/iconfont.css" />
  9. <link rel="stylesheet" href="css/headerfooter.css" />
  10. <!-- <link rel="stylesheet" href="css/miaosha.css"> -->
  11. <title>Document</title>
  12. </head>
  13. <style>
  14. body {
  15. margin: 0;
  16. padding: 0;
  17. }
  18. main div.box {
  19. background-color: #c82519;
  20. border: 1px solid #c82519;
  21. /* position: relative; */
  22. /* top: 0.001rem;
  23. left: 0.01px; */
  24. /* width: 400px; */
  25. height: 150px;
  26. display: flex;
  27. /* 设置弧形 */
  28. border-bottom-left-radius: 80px;
  29. border-bottom-right-radius: 80px;
  30. }
  31. main div.box {
  32. /*父级定位*/
  33. position: static;
  34. position: relative;
  35. /* width: 350px;
  36. left: 0; */
  37. }
  38. main div.tupian>img {
  39. width: calc(100vw / 3.75) border-radius: 0.1rem;
  40. margin-left: 1rem;
  41. margin-right: 1rem;
  42. }
  43. /* 轮播图 */
  44. main div.tupian>img {
  45. /*绝对定位*/
  46. position: absolute;
  47. height: 150px;
  48. top: 10px;
  49. margin-left: 0.1rem;
  50. margin-right: 0.1rem;
  51. padding-right: 0.2rem;
  52. /* right: 1px;
  53. left: 13px; */
  54. }
  55. /* 导航 */
  56. main ul.navs li.item a {
  57. /* margin-top: 0.08rem; */
  58. display: grid;
  59. color: #666;
  60. font-size: 0.07rem;
  61. place-items: center;
  62. ;
  63. }
  64. body main ul.navs {
  65. display: grid;
  66. grid-template-columns: repeat(5, 1fr);
  67. gap: 0 0.1rem;
  68. /* gap: 1vw; */
  69. place-items: center;
  70. padding: 0.11rem;
  71. border: 5px;
  72. }
  73. main ul.navs li.item>a img {
  74. width: 50px;
  75. }
  76. /* 3. 商品列表 */
  77. main .list {
  78. display: grid;
  79. grid-template-columns: repeat(2, 1fr);
  80. gap: 0 0.1rem;
  81. place-items: center;
  82. margin-right: 0.1rem;
  83. border-left: 9rem;
  84. padding-left: 0.13rem;
  85. font-size: 0.11rem;
  86. }
  87. main .list .item img {
  88. /* border-radius: 上 右 下 左; 顺时针 */
  89. border-radius: 0.1rem 0.1rem 0 0;
  90. }
  91. /* 商品描述 */
  92. main .list .item .desc {
  93. padding: 0.1rem;
  94. font-size: smaller;
  95. }
  96. main .list .item .desc>a{
  97. color: black;
  98. }
  99. /* 价格 */
  100. main .list .item .price .iconfont {
  101. color: #f50;
  102. font-size: smaller;
  103. }
  104. main .list .item .price span:last-of-type {
  105. color: #bbb;
  106. font-size: smaller;
  107. }
  108. </style>
  109. <body>
  110. <header>
  111. <a href="" class="logo"> <img src="images/toubu.png" alt="" /></a>
  112. <a href="" class="sousuo">
  113. <span>京东物流一日达</span>
  114. <!-- <span>搜索</span> -->
  115. </a>
  116. <div class="login">
  117. <a href="">登录</a>
  118. </div>
  119. </header>
  120. <main>
  121. <div class="box"></div>
  122. <div class="tupian">
  123. <img src="images/ad-003.png" alt="这是图片" />
  124. </div>
  125. <ul class="navs">
  126. <li class="item">
  127. <a href=""> <img src="images/chaoshi.png" alt="" /></a>
  128. <a href="">京东超市</a>
  129. </li>
  130. <li class="item">
  131. <a href=""> <img src="images/shuma.png" alt="" /></a>
  132. <a href="">数码电器</a>
  133. </li>
  134. <li class="item">
  135. <a href=""> <img src="images/baihuo.png" alt="" /></a>
  136. <a href="">京东百货</a>
  137. </li>
  138. <li class="item">
  139. <a href=""> <img src="images/shengxian.png" alt="" /></a>
  140. <a href="">京东生鲜</a>
  141. </li>
  142. <li class="item">
  143. <a href=""> <img src="images/daojia.png" alt="" /></a>
  144. <a href="">京东到家</a>
  145. </li>
  146. <li class="item">
  147. <a href=""> <img src="images/jiaofei.png" alt="" /></a>
  148. <a href="">充值缴费</a>
  149. </li>
  150. <li class="item">
  151. <a href=""> <img src="images/haodian.png" alt="" /></a>
  152. <a href="">附近好店</a>
  153. </li>
  154. <li class="item">
  155. <a href=""> <img src="images/lingjuan.png" alt="" /></a>
  156. <a href="">领卷</a>
  157. </li>
  158. <li class="item">
  159. <a href=""> <img src="images/jintie.png" alt="" /></a>
  160. <a href="">领金贴</a>
  161. </li>
  162. <li class="item">
  163. <a href=""> <img src="images/huiyuan.png" alt="" /></a>
  164. <a href="">plus会员</a>
  165. </li>
  166. </ul>
  167. <ul class="list">
  168. <li class="item">
  169. <a href=""><img src="images/meinv.png" alt="" /></a>
  170. <div class="desc">
  171. <a href="">夏款薄款人造棉绸睡衣女款绵绸短袖短裤套装家居服</a>
  172. <div class="price">
  173. <span class="iconfont icon-renminbi_o">$169</span>
  174. <span>123人已购买</span>
  175. </div>
  176. </div>
  177. </li>
  178. <li class="item">
  179. <a href=""><img src="images/meinv.png" alt="" /></a>
  180. <div class="desc">
  181. <a href="">夏款薄款人造棉绸睡衣女款绵绸短袖短裤套装家居服</a>
  182. <div class="price">
  183. <span class="iconfont icon-renminbi_o">$169</span>
  184. <span>123人已购买</span>
  185. </div>
  186. </div>
  187. </li>
  188. <li class="item">
  189. <a href=""><img src="images/meinv.png" alt="" /></a>
  190. <div class="desc">
  191. <a href="">夏款薄款人造棉绸睡衣女款绵绸短袖短裤套装家居服</a>
  192. <div class="price">
  193. <span class="iconfont icon-renminbi_o">$169</span>
  194. <span>123人已购买</span>
  195. </div>
  196. </div>
  197. </li>
  198. <li class="item">
  199. <a href=""><img src="images/meinv1.png" alt="" /></a>
  200. <div class="desc">
  201. <a href="">夏款薄款人造棉绸睡衣女款绵绸短袖短裤套装家居服</a>
  202. <div class="price">
  203. <span class="iconfont icon-renminbi_o">$169</span>
  204. <span>123人已购买</span>
  205. </div>
  206. </div>
  207. </li>
  208. <li class="item">
  209. <a href=""><img src="images/meinv1.png" alt="" /></a>
  210. <div class="desc">
  211. <a href="">夏款薄款人造棉绸睡衣女款绵绸短袖短裤套装家居服</a>
  212. <div class="price">
  213. <span class="iconfont icon-renminbi_o">$169</span>
  214. <span>123人已购买</span>
  215. </div>
  216. </div>
  217. </li>
  218. <li class="item">
  219. <a href=""><img src="images/meinv1.png" alt="" /></a>
  220. <div class="desc">
  221. <a href="">夏款薄款人造棉绸睡衣女款绵绸短袖短裤套装家居服</a>
  222. <div class="price">
  223. <span class="iconfont icon-renminbi_o">$169</span>
  224. <span>123人已购买</span>
  225. </div>
  226. </div>
  227. </li>
  228. <li class="item">
  229. <a href=""><img src="images/meinv1.png" alt="" /></a>
  230. <div class="desc">
  231. <a href="">夏款薄款人造棉绸睡衣女款绵绸短袖短裤套装家居服</a>
  232. <div class="price">
  233. <span class="iconfont icon-renminbi_o">$169</span>
  234. <span>123人已购买</span>
  235. </div>
  236. </div>
  237. </li>
  238. <li class="item">
  239. <a href=""><img src="images/meinv1.png" alt="" /></a>
  240. <div class="desc">
  241. <a href="">夏款薄款人造棉绸睡衣女款绵绸短袖短裤套装家居服</a>
  242. <div class="price">
  243. <span class="iconfont icon-renminbi_o">$169</span>
  244. <span>123人已购买</span>
  245. </div>
  246. </div>
  247. </li>
  248. <li class="item">
  249. <a href=""><img src="images/meinv1.png" alt="" /></a>
  250. <div class="desc">
  251. <a href="">夏款薄款人造棉绸睡衣女款绵绸短袖短裤套装家居服</a>
  252. <div class="price">
  253. <span class="iconfont icon-renminbi_o">$169</span>
  254. <span>123人已购买</span>
  255. </div>
  256. </div>
  257. </li>
  258. <li class="item">
  259. <a href=""><img src="images/meinv1.png" alt="" /></a>
  260. <div class="desc">
  261. <a href="">夏款薄款人造棉绸睡衣女款绵绸短袖短裤套装家居服</a>
  262. <div class="price">
  263. <span class="iconfont icon-renminbi_o">$169</span>
  264. <span>123人已购买</span>
  265. </div>
  266. </div>
  267. </li>
  268. <li class="item">
  269. <a href=""><img src="images/meinv1.png" alt="" /></a>
  270. <div class="desc">
  271. <a href="">夏款薄款人造棉绸睡衣女款绵绸短袖短裤套装家居服</a>
  272. <div class="price">
  273. <span class="iconfont icon-renminbi_o">$169</span>
  274. <span>123人已购买</span>
  275. </div>
  276. </div>
  277. </li>
  278. <li class="item">
  279. <a href=""><img src="images/meinv1.png" alt="" /></a>
  280. <div class="desc">
  281. <a href="">夏款薄款人造棉绸睡衣女款绵绸短袖短裤套装家居服</a>
  282. <div class="price">
  283. <span class="iconfont icon-renminbi_o">$169</span>
  284. <span>123人已购买</span>
  285. </div>
  286. </div>
  287. </li>
  288. <li class="item">
  289. <a href=""><img src="images/meinv1.png" alt="" /></a>
  290. <div class="desc">
  291. <a href="">夏款薄款人造棉绸睡衣女款绵绸短袖短裤套装家居服</a>
  292. <div class="price">
  293. <span class="iconfont icon-renminbi_o">$169</span>
  294. <span>123人已购买</span>
  295. </div>
  296. </div>
  297. </li>
  298. <li class="item">
  299. <a href=""><img src="images/meinv1.png" alt="" /></a>
  300. <div class="desc">
  301. <a href="">夏款薄款人造棉绸睡衣女款绵绸短袖短裤套装家居服</a>
  302. <div class="price">
  303. <span class="iconfont icon-renminbi_o">$169</span>
  304. <span>123人已购买</span>
  305. </div>
  306. </div>
  307. </li>
  308. </ul>
  309. </main>
  310. <footer>
  311. <a href="">
  312. <span class="iconfont icon-jingdong"></span>
  313. <span>首页</span>
  314. </a>
  315. <a href="">
  316. <span class="iconfont icon-fenlei"></span>
  317. <span>分类</span>
  318. </a>
  319. <a href="">
  320. <span class="iconfont icon-xiajiang"></span>
  321. <span>惊喜</span>
  322. </a>
  323. <a href="">
  324. <span class="iconfont icon-gouwucheman"></span>
  325. <span>购物车</span>
  326. </a>
  327. <a href="">
  328. <span class="iconfont icon-wode-wode"></span>
  329. <span>未登录</span>
  330. </a>
  331. </footer>
  332. </body>
  333. </html>

页眉和页脚部分css代码

  1. *{
  2. margin: 0;
  3. padding: ;
  4. box-sizing: border-box;
  5. }
  6. header,footer{
  7. height: 50px;
  8. background-color: #c82519;
  9. position: fixed;
  10. z-index: 100;
  11. }
  12. header{
  13. top: 0;
  14. left: 0;
  15. right: 0;
  16. }
  17. footer{
  18. bottom: 0;
  19. left: 0;
  20. right: 0;
  21. }
  22. main{
  23. background-color: ;
  24. min-height: 2000px;
  25. overflow: hidden;
  26. position: relative;
  27. top: 50px;
  28. }
  29. header{
  30. display: grid;
  31. grid-template-columns: 0.28rem 1fr 0.38rem;
  32. grid-auto-rows: 0.3rem;
  33. place-items: center;
  34. gap: 0.1rem;
  35. }
  36. header a.logo{
  37. display: flex;
  38. padding-left: 0.1rem;
  39. }
  40. header a.sousuo{
  41. width: 100%;
  42. height: 30px;
  43. overflow: hidden;
  44. background-color: #fff;
  45. color: #f7f7f7;
  46. border-radius: 0.15rem;
  47. /* font-size: 12px; */
  48. display: flex;
  49. place-content: space-between;
  50. place-items: center;
  51. -webkit-box-align: center;
  52. line-height: 30px
  53. position: absolute;
  54. padding-right: 10px;
  55. box-sizing: border-box;
  56. }
  57. header a.sousuo span{
  58. color: lightslategray;
  59. display: flex;
  60. margin: 50px;
  61. font-size: 0.1rem;
  62. }
  63. footer{
  64. background-color: #fff;
  65. color: #8b8b8b;
  66. display: flex;
  67. flex-wrap: nowrap;
  68. place-content: center;
  69. place-content: space-between;
  70. place-content: space-evenly;
  71. }
  72. footer >a {
  73. color: #8b8b8b;
  74. display: grid;
  75. place-items: center;
  76. }
  77. footer >a >span{
  78. font-size:0.08rem;
  79. }
  80. footer >a >span.iconfont{
  81. color:#8b8b8b;
  82. font-size: large;
  83. }
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议