博客列表 >淘宝PC端首页框架

淘宝PC端首页框架

手机用户1594223549
手机用户1594223549原创
2022年11月02日 19:48:33434浏览

一.输出成果

二.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: 35px;
  13. background-color: greenyellow;
  14. }
  15. .wrap header .top .content {
  16. width: 1300px;
  17. height: 35px;
  18. /* inherit继承也可以 */
  19. background-color: wheat;
  20. margin: auto;
  21. }
  22. /* 头部:快速入口 */
  23. .wrap header .entry {
  24. height: 100px;
  25. padding: 15px;
  26. }
  27. .wrap header .entry .content {
  28. max-width: 1300px;
  29. min-width: 940px;
  30. height: inherit;
  31. background-color: aqua;
  32. margin: auto;
  33. /* 网格布局 */
  34. display: grid;
  35. grid-template-columns: 80px repeat(5,1fr);
  36. grid-auto-rows: 80px;
  37. gap: 10px;
  38. padding: 10px;
  39. }
  40. .wrap header .entry .content .item {
  41. background-color: lightblue;
  42. border-radius: 22px;
  43. }
  44. /* ---------------------------- */
  45. /* 主体 */
  46. .wrap main {
  47. max-width: 1300px;
  48. min-width: 940px;
  49. min-height: 1000px;
  50. margin: 20px auto;
  51. padding: 20px;
  52. background-color: lightpink;
  53. }
  54. /* 主体——搜索框 */
  55. .wrap main .search {
  56. height: 90px;
  57. display: grid;
  58. grid-template-columns: 210px 1fr 220px;
  59. gap: 10px;
  60. /* 粘性定位 */
  61. position: sticky;
  62. top: 0;
  63. }
  64. .wrap main .search .item {
  65. background-color: lightskyblue;
  66. }
  67. /* 主体-导航区 */
  68. .wrap main .navs {
  69. height: 420px;
  70. margin: 20px 0;
  71. display: grid;
  72. grid-template-columns: 270px 1fr;
  73. gap: 10px;
  74. }
  75. .wrap main .navs > * {
  76. background-color: lightgoldenrodyellow;
  77. }
  78. .wrap main .navs .user {
  79. display: grid;
  80. grid-template-columns: 564px 1fr;
  81. grid-template-rows: 42px 1fr;
  82. gap: 10px;
  83. }
  84. .wrap main .navs .user > * {
  85. background-color: lightskyblue;
  86. }
  87. .wrap main .navs .user .user-top {
  88. grid-column: span 2;
  89. }
  90. /* 主体-标题区 */
  91. .wrap main .title {
  92. background-color: lightseagreen;
  93. display: flex;
  94. place-items: center;
  95. }
  96. .wrap main .title .tag {
  97. background: linear-gradient(to left,orangered, orange);
  98. color: white;
  99. border-radius: 5px;
  100. padding: 0 5px;
  101. margin-left: 5px;
  102. /* 显示箭头光标 */
  103. cursor: default;
  104. }
  105. /* 主体-商品列表 */
  106. .wrap main .list {
  107. margin: 20px 0;
  108. display: grid;
  109. grid-template-columns: repeat(3,1fr);
  110. grid-auto-rows: 170px;
  111. gap: 10px;
  112. }
  113. .wrap main .list .item {
  114. background-color: lightblue;
  115. border-radius: 10px;
  116. display: grid;
  117. grid-template-columns: 150px 1fr;
  118. gap: 10px;
  119. padding: 10px;
  120. }
  121. .wrap main .list .item > * {
  122. background-color: wheat;
  123. border-radius: 10px;
  124. }
  125. .wrap main .list .item .detail {
  126. display: grid;
  127. grid-template-rows: 1fr 25px;
  128. padding: 10px;
  129. place-content: space-between;
  130. }
  131. .wrap main .list .item .detail > * {
  132. background-color: lightgreen;
  133. }
  134. /* 媒体查询 */
  135. @media (max-width: 940px) {
  136. .wrap header .entry .content {
  137. grid-template-columns: 80px repeat(4, 1fr);
  138. }
  139. main .list {
  140. grid-template-columns: repeat(2, 1fr);
  141. }
  142. main .navs {
  143. grid-template-columns: 1fr;
  144. }
  145. main .navs .cate {
  146. display: none;
  147. }
  148. }
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议