博客列表 >Grid /编写淘宝网PC端首页布局

Grid /编写淘宝网PC端首页布局

          
          原创
2022年11月02日 10:30:04423浏览
  1. <!doctype html>
  2. <!doctype html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8">
  6. <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  7. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8. <title>Document</title>
  9. <link rel="stylesheet" href="my/css.css">
  10. <link rel="stylesheet" href="font_icon/iconfont.css">
  11. <!-- 作业内容:-->
  12. <!-- 1. 使用Grid / Flex , 编写淘宝网PC端首页布局-->
  13. <!-- 2. (可选) 尝试动手实现淘宝移动端首页的主导航和商品列表-->
  14. <style>
  15. /*鼠标移上去的样式*/
  16. header a:hover{
  17. color: red;
  18. }
  19. /*字体大小 间距*/
  20. .top_right >a,.top_left>a,.top_left>span{
  21. color: #6C6C6C;
  22. font-size: 12px;
  23. padding-left: 15px;
  24. cursor: pointer;
  25. }
  26. .top_left, .top_right{
  27. padding-top: 3px;
  28. /*margin-left:191px*/
  29. }
  30. header {
  31. display: grid;
  32. background-color: #f5f5f5;
  33. grid-template-rows:35px;
  34. grid-template-columns: repeat(2,605px);
  35. place-content: center;
  36. }
  37. .top_right{
  38. padding-left:84px
  39. }
  40. /*商品分类 免费开店间距单独处理*/
  41. .top_right a:nth-of-type(5){
  42. padding-left: 1px;
  43. }
  44. /*商品分类,免费开店间距*/
  45. .top_right span{
  46. margin-left: 10px;
  47. color: #ddd;
  48. margin-right: -9px;
  49. }
  50. /*亲,请登录红色处理*/
  51. .top_left a:first-of-type{
  52. color: red;
  53. }
  54. .a1{
  55. display: grid;
  56. grid-template-rows: 100px;
  57. grid-template-columns:100px repeat(5,209px);
  58. place-content: center;
  59. gap: 8px;
  60. width: 100%;
  61. background-color: #ff72b5;
  62. position: relative;
  63. }
  64. .a1>a:first-of-type>img{
  65. /*border: 1px solid red;*/
  66. width: 80px;
  67. height: 80px;
  68. }
  69. .a1 >a{
  70. margin-top: 10px;
  71. padding-right: 50px;
  72. }
  73. .icobk{
  74. position: absolute;
  75. top: 14px;
  76. margin-left: -75px;
  77. border-radius:10px;
  78. height: 66px;
  79. }
  80. .main{
  81. display: grid;
  82. grid-template-rows: 100px;
  83. grid-template-columns: repeat(4,300px);
  84. place-content: center;
  85. }
  86. /*LOG部分*/
  87. .logo {
  88. width: 143px;
  89. place-self: center start;
  90. }
  91. .iput{
  92. border: 2px solid #FF5000;
  93. width: 600px;
  94. border-radius: 30px;
  95. place-self: center;
  96. position: relative;
  97. padding-left:10px;
  98. }
  99. /*输入框行高*/
  100. .iput span{
  101. line-height:40px;
  102. margin-left: 10px;
  103. }
  104. /*输入框的竖线*/
  105. .iput span:nth-of-type(2){
  106. border-left: 1px solid #F3F0F0;
  107. color: #9b9b9b;
  108. padding-left: 10px;
  109. }
  110. /*输入框美化,去除边框线*/
  111. .iput>span>input{
  112. height: 38px;
  113. width: 400px;
  114. color: red;
  115. border: none;
  116. background-color: white;
  117. }
  118. /* 宝贝搜索下面的产品超链接*/
  119. .search{
  120. position:absolute;
  121. top: 50px;
  122. font-size: 12px;
  123. }
  124. /*宝贝搜索下面的产品超链接间距*/
  125. .search >a{
  126. margin-left: 10px;
  127. color: #666;
  128. }
  129. /*提交按钮*/
  130. .iput > button{
  131. color: white;
  132. width: 80px;
  133. background-image: linear-gradient(145deg,#ff9000,#ff5000 77%);
  134. font-weight: 700;
  135. border: 1px solid red;
  136. right: 2px;
  137. padding-top: 1px;
  138. position: absolute;
  139. border-radius: 30px;
  140. bottom:3px;
  141. font-size: 20px;
  142. height: 35px;
  143. }
  144. .a1>a>h3,.a1>a>p{
  145. position: relative;
  146. right: 0;
  147. top: -66px;
  148. left: 29px;
  149. color: white;
  150. }
  151. /*二维码大小*/
  152. .qr .obj{width: 75px;border: 1px solid silver; margin-top: 10px}
  153. .qr>.obj>img{width: 60px;margin: 6px 0 0 6px;}
  154. .qr>.obj>small{
  155. display: block;
  156. font-size: 12px;
  157. margin: 6px 0 0 6px;
  158. margin-left: 9px;
  159. color: red;
  160. }
  161. .qr {
  162. grid-area: 1/4/1/span 3;
  163. margin-left:217px;
  164. }
  165. .bananer{
  166. display: grid;
  167. grid-template-rows: 410px;
  168. grid-template-columns: 270px 900px ;
  169. place-content: center;
  170. margin-top:40px
  171. }
  172. /*分类*/
  173. .left_class{
  174. /*margin: 50px 0 0 0;*/
  175. background-color: #F7F9FA;
  176. border-radius: 10px;
  177. }
  178. .nav{
  179. display: grid;
  180. grid-template-rows: 40px 100px;
  181. grid-template-columns: 900px 100px ;
  182. grid-auto-flow: column;
  183. margin-left: 10px;
  184. }
  185. </style>
  186. </head>
  187. <body>
  188. <header>
  189. <div class="top_left">
  190. <span>中国大陆 v</span>
  191. <a href="">亲,请登录</a>
  192. <a href="">免费注册</a>
  193. <a href="">手机逛淘宝</a>
  194. <a href="">网页无障碍</a>
  195. </div>
  196. <div class="top_right">
  197. <a href="">我的淘宝 v</a>
  198. <a href="">购物车</a>
  199. <a href="">收藏夹 v</a>
  200. <a href="">商品分类</a>
  201. <a href="">免费开店</a>
  202. <span> |</span>
  203. <a href="">千牛卖家中心 v</a>
  204. <a href="">联系客服 v</a>
  205. </div>
  206. </header>
  207. <div class="a1">
  208. <a href=""><img src="my/img/tm.png" alt=""></a>
  209. <a href=""><img src="my/img/bg1.png" alt=""><img class= 'icobk' src="my/img/b1.webp" alt=""><h3>家装百科</h3><p>避坑指南</p></a>
  210. <a href=""><img src="my/img/bg2.png" alt=""><img class= 'icobk' src="my/img/b2.webp" alt=""><h3>图像音像</h3><p>热度好书推荐</p></a>
  211. <a href=""><img src="my/img/bg3.png" alt=""><img class= 'icobk' src="my/img/b3.webp" alt=""><h3>开新出行</h3><p>爆款破冰价</p></a>
  212. <a href=""><img src="my/img/bg4.png" alt=""><img class= 'icobk' src="my/img/b4.webp" alt=""><h3>国潮东方</h3><p>不止5折</p></a>
  213. <a href=""><img src="my/img/bg5.png" alt=""><img class= 'icobk' src="my/img/b5.webp" alt=""><h3>全球家电</h3><p>抢5折家电</p></a>
  214. </div>
  215. <!--LOGO输入框-->
  216. <div class="main" >
  217. <div class="logo"><img src="my/img/taobao.png" alt=""></div>
  218. <div class="iput">
  219. <span>宝贝 v</span>
  220. <span><input placeholder="连衣裙"></span>
  221. <button type="submit">提交</button>
  222. <div class="search">
  223. <a href="">新款连衣裙</a>
  224. <a href="">四件套</a>
  225. <a href="">潮流T恤</a>
  226. <a href="">时尚女鞋</a>
  227. <a href="">短裤</a>
  228. <a href="">半身裙</a>
  229. <a href="">男士外套</a>
  230. <a href="">墙纸</a>
  231. <a href="">行车记录仪</a>
  232. </div>
  233. </div>
  234. <div class="qr">
  235. <div class="obj"><small>下载淘宝</small><img src="my/img/qr.png"></div>
  236. </div>
  237. </div>
  238. <div class="bananer">
  239. <!-- 分类-->
  240. <div class="left_class">
  241. <h3>分类</h3>
  242. <ul>
  243. <li> <span class="iconfont icon-qunzi"></span>
  244. <a href="">女装</a>
  245. <span>/</span>
  246. <a href="">内衣</a>
  247. <span>/</span>
  248. <a href="">奢品 </a></li>
  249. <li> <span class="iconfont icon-chunjishangxin-peishi-"></span>
  250. <a href="">女鞋</a>
  251. <span>/</span>
  252. <a href="">男鞋</a>
  253. <span>/</span>
  254. <a href="">箱包 </a></li>
  255. <li> <span class="iconfont icon-meizhuang"></span>
  256. <a href="">美妆</a>
  257. <span>/</span>
  258. <a href="">饰品</a>
  259. <span>/</span>
  260. <a href="">洗护 </a></li>
  261. <li> <span class="iconfont icon-nanzhuang"></span>
  262. <a href="">男装</a>
  263. <span>/</span>
  264. <a href="">运动</a>
  265. <span>/</span>
  266. <a href="">百货 </a></li>
  267. <li> <span class="iconfont icon-qunzi"></span>
  268. <a href="">手机</a>
  269. <span>/</span>
  270. <a href="">数码</a>
  271. <span>/</span>
  272. <a href="">企业礼品 </a></li>
  273. <li> <span class="iconfont icon-weibiaoti2fuzhi13"></span>
  274. <a href="">家装</a>
  275. <span>/</span>
  276. <a href="">电器</a>
  277. <span>/</span>
  278. <a href="">车品 </a></li>
  279. <li> <span class="iconfont icon-shipin"></span>
  280. <a href="">食品</a>
  281. <span>/</span>
  282. <a href="">生鲜</a>
  283. <span>/</span>
  284. <a href="">母婴 </a></li>
  285. <li> <span class="iconfont icon-yiyaoxiang
  286. "></span>
  287. <a href="">医药</a>
  288. <span>/</span>
  289. <a href="">保健</a>
  290. <span>/</span>
  291. <a href="">进口 </a></li>
  292. </ul>
  293. </div>
  294. <div class="nav">
  295. <!-- bananer上面的文字-->
  296. <div class="tianmao">
  297. <a href="">天猫</a>
  298. <span> |</span>
  299. <a href="">聚划算</a>
  300. <span> |</span>
  301. <a href="">天猫超市</a>
  302. <span> |</span>
  303. <a href="">司法拍卖</a>
  304. <span> |</span>
  305. <a href="">飞猪旅行</a>
  306. <span> |</span>
  307. <a href="">天天特卖</a>
  308. <span> |</span>
  309. <a href="">极有家</a>
  310. <span> |</span>
  311. <a href="">淘宝直播</a>
  312. </div>
  313. <!-- bananer图-->
  314. <!-- <div class="bananer_img">-->
  315. <!-- <img style="height: 50px" src="my/img/bananer.jpg" alt=""></div>-->
  316. <div class="self_person"></div>
  317. </div>
  318. <!-- 个人中心-->
  319. <div class="persons"></div>
  320. </div>
  321. <br>
  322. <br>
  323. <br>
  324. <br>
  325. <br>
  326. <br>
  327. <br>
  328. <footer style="background-color: silver;height: 80px;text-align: center;color: red">
  329. 页脚
  330. </footer>
  331. </body>
  332. </html>

运行结果

还未完成

上一条:淘宝首页丐版下一条:10.28作业
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议