仿京东移动端首页的”秒杀区”样式

请帮忙看看有没有多用到fixed属性

  • 图片欣赏

    • html代码
    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. <title>Document</title>
    8. <link rel="stylesheet" href="//at.alicdn.com/t/font_2658027_x57wjewo7gk.css" />
    9. <link rel="stylesheet" href="//at.alicdn.com/t/font_2657095_ks49h5qoay.css" />
    10. <link rel="stylesheet" href="//at.alicdn.com/t/font_2657269_v7m0y1kdcb8.css" />
    11. </head>
    12. <body>
    13. <!-- 导航 -->
    14. <div class="header">
    15. <!-- 左侧 -->
    16. <div class="cd iconfont icon-A"></div>
    17. <!--中间 -->
    18. <div class="zhuti">
    19. <div class="ziti">JD</div>
    20. <div class="sou iconfont icon-woyaosousuo"></div>
    21. <input type="text" value="电子电器" class="sou_1" />
    22. </div>
    23. <!-- 右侧 -->
    24. <a href="" class="deng">登录</a>
    25. </div>
    26. <!-- 主体 -->
    27. <div class="main">
    28. <!-- 小导航 -->
    29. <ul class="nav">
    30. <li class="nav_1">
    31. <a href=""
    32. ><img
    33. src="https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/125678/35/5947/4868/5efbf28cEbf04a25a/e2bcc411170524f0.png"
    34. alt=""
    35. /></a>
    36. <a href="">京东超市</a>
    37. </li>
    38. <li class="nav_1">
    39. <a href=""
    40. ><img
    41. src="https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/135931/4/3281/5598/5efbf2c0Edbdc82c7/ed9861b4ddfb9f30.png.webp"
    42. alt=""
    43. /></a>
    44. <a href="">数码电器</a>
    45. </li>
    46. <li class="nav_1">
    47. <a href=""
    48. ><img
    49. src="https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/140012/8/1804/3641/5efbf318E38bd5dad/0db99d859ab16ce9.png.webp"
    50. alt=""
    51. /></a>
    52. <a href="">京东服饰</a>
    53. </li>
    54. <li class="nav_1">
    55. <a href=""
    56. ><img
    57. src="https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/129215/21/5978/3618/5efbf344Ebec23ae8/59712d986b10bb0a.png.webp"
    58. alt=""
    59. /></a>
    60. <a href="">京东生鲜</a>
    61. </li>
    62. <li class="nav_1">
    63. <a href=""
    64. ><img
    65. src="https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/116602/7/11200/3796/5efbf375Ebba41029/f07cc166f368fa05.png.webp"
    66. alt=""
    67. /></a>
    68. <a href="">京东到家</a>
    69. </li>
    70. <li class="nav_1">
    71. <a href=""
    72. ><img
    73. src="https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/146390/3/1846/4909/5efbf39aEe5f5f797/300071558a9ab078.png.webp"
    74. alt=""
    75. /></a>
    76. <a href="">充值缴费</a>
    77. </li>
    78. <li class="nav_1">
    79. <a href=""
    80. ><img
    81. src="https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/179511/33/4023/3422/609e0d45Ea495a996/3783165b48cf1e08.png.webp"
    82. alt=""
    83. /></a>
    84. <a href="">9.9元拼</a>
    85. </li>
    86. <li class="nav_1">
    87. <a href=""
    88. ><img
    89. src="https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/113589/24/11332/4897/5efbf3feE705d87db/e5c12d5e943266b9.png.webp"
    90. alt=""
    91. /></a>
    92. <a href="">领券</a>
    93. </li>
    94. <li class="nav_1">
    95. <a href=""
    96. ><img
    97. src="https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/131663/33/3380/3674/5efbf50fEf79cf314/af4b57d2383e605d.png.webp"
    98. alt=""
    99. /></a>
    100. <a href="">领金贴</a>
    101. </li>
    102. <li class="nav_1">
    103. <a href=""
    104. ><img
    105. src="https://m.360buyimg.com/mobilecms/s120x120_jfs/t1/123730/37/5924/4189/5efbf567E0a226121/d04df7c74c87cf68.png.webp"
    106. alt=""
    107. /></a>
    108. <a href="">PLUS会员</a>
    109. </li>
    110. </ul>
    111. <!-- \秒杀专区 -->
    112. <div class="ms">
    113. <div class="lefe">京东秒杀</div>
    114. <div class="ms_0">
    115. <div class="ms_2">10月</div>
    116. <div class="ms_3">00</div>
    117. :
    118. <div class="ms_3">01</div>
    119. :
    120. <div class="ms_3">15</div>
    121. </div>
    122. <div class="right">秒杀专区</div>
    123. </div>
    124. <ul class="tp">
    125. <li class="tp_1">
    126. <a href=""
    127. ><img
    128. src="https://img12.360buyimg.com/mobilecms/s372x372_jfs/t1/139529/2/20110/95537/5fe476a2Ec7d6adb7/1b9a2ea03575fe96.jpg!q70.dpg.webp"
    129. alt=""
    130. /></a>
    131. <div class="iconfont icon-tubiaozhizuomoban">18</div>
    132. <div class="iconfont icon-tubiaozhizuomoban">78</div>
    133. </li>
    134. <li class="tp_1">
    135. <a href=""
    136. ><img
    137. src="https://img12.360buyimg.com/mobilecms/s372x372_jfs/t1/139529/2/20110/95537/5fe476a2Ec7d6adb7/1b9a2ea03575fe96.jpg!q70.dpg.webp"
    138. alt=""
    139. /></a>
    140. <div class="iconfont icon-tubiaozhizuomoban">18</div>
    141. <div class="iconfont icon-tubiaozhizuomoban">78</div>
    142. </li>
    143. <li class="tp_1">
    144. <a href=""
    145. ><img
    146. src="https://img12.360buyimg.com/mobilecms/s372x372_jfs/t1/139529/2/20110/95537/5fe476a2Ec7d6adb7/1b9a2ea03575fe96.jpg!q70.dpg.webp"
    147. alt=""
    148. /></a>
    149. <div class="iconfont icon-tubiaozhizuomoban">18</div>
    150. <div class="iconfont icon-tubiaozhizuomoban">78</div>
    151. </li>
    152. <li class="tp_1">
    153. <a href=""
    154. ><img
    155. src="https://img12.360buyimg.com/mobilecms/s372x372_jfs/t1/139529/2/20110/95537/5fe476a2Ec7d6adb7/1b9a2ea03575fe96.jpg!q70.dpg.webp"
    156. alt=""
    157. /></a>
    158. <div class="iconfont icon-tubiaozhizuomoban">18</div>
    159. <div class="iconfont icon-tubiaozhizuomoban">78</div>
    160. </li>
    161. <li class="tp_1">
    162. <a href=""
    163. ><img
    164. src="https://img12.360buyimg.com/mobilecms/s372x372_jfs/t1/139529/2/20110/95537/5fe476a2Ec7d6adb7/1b9a2ea03575fe96.jpg!q70.dpg.webp"
    165. alt=""
    166. /></a>
    167. <div class="iconfont icon-tubiaozhizuomoban">18</div>
    168. <div class="iconfont icon-tubiaozhizuomoban">78</div>
    169. </li>
    170. <li class="tp_1">
    171. <a href=""
    172. ><img
    173. src="https://img12.360buyimg.com/mobilecms/s372x372_jfs/t1/139529/2/20110/95537/5fe476a2Ec7d6adb7/1b9a2ea03575fe96.jpg!q70.dpg.webp"
    174. alt=""
    175. /></a>
    176. <div class="iconfont icon-tubiaozhizuomoban">18</div>
    177. <div class="iconfont icon-tubiaozhizuomoban">78</div>
    178. </li>
    179. </ul>
    180. </div>
    181. <!-- 底部 -->
    182. <div class="footer">
    183. <div>
    184. <div class="iconfont icon-shouye"></div>
    185. <span>首页</span>
    186. </div>
    187. <div>
    188. <div class="iconfont icon-fenlei"></div>
    189. <span>分类</span>
    190. </div>
    191. <div>
    192. <div class="iconfont icon-caidan1"></div>
    193. <span>京喜</span>
    194. </div>
    195. <div>
    196. <div class="iconfont icon-gouwuche"></div>
    197. <span>购物车</span>
    198. </div>
    199. <div>
    200. <div class="iconfont icon-wode"></div>
    201. <span>我的</span>
    202. </div>
    203. </div>
    204. </body>
    205. </html>

  • CSS样式代码

.header {
height: 5rem;
background: rgb(248, 192, 8);
position: fixed;
left: 0;
right: 0;
top: 0;
z-index: 100;
}
.main {
height: 80rem;
background: rgb(240, 224, 224);
position: absolute;
top: 5rem;
left: 0;
right: 0;
}
.footer {
height: 5rem;
background: rgb(247, 218, 91);
position: fixed;
left: 0;
right: 0;
bottom: 0;
z-index: 100;
}
/ 头部 /
.header {
display: flex;

align-items: center;
}
.header .cd {
flex: 1;
text-align: center;
font-size: 2rem;
color: red;
}
.header .zhuti {
flex: 6;
display: flex;
border-radius: 2rem;
background: floralwhite;
padding: 0.5rem;
}
.header .zhuti .ziti {
color: #e43130;
flex: 0 1 4rem;
font-size: 2rem;
text-align: center;
line-height: 2rem;
}
.header .zhuti .sou {
border-left: 1px solid;
flex: 0 1 4rem;
color: #aaa;
text-align: center;
line-height: 2rem;
}
.header .zhuti .sou_1 {
flex: auto;
border: none;
outline: none;
color: #aaa;
}
.header .deng {
flex: 1;
color: red;
text-align: center;
}
/ 底部 /
.footer {
display: flex;
justify-content: space-around;
align-items: center;
}
.footer div {
display: flex;
flex-flow: column nowrap;
align-items: center;
}
.footer div:hover {
cursor: pointer;
}
.footer div .iconfont {
font-size: 2.5rem;
}
.footer span {
font-size: 1rem;
}

/ 秒杀专区 /
.main .ms {
padding: 1rem;
display: flex;
justify-content: space-between;
align-items: center;
}
.main .ms .lefe {
font-size: 1.5rem;
margin-right: 0.5rem;
}
.main .ms .ms_0 {
display: flex;
flex: 1;
justify-content: flex-start;
}
.main .ms .ms_0 .ms_2 {
color: #e43130;
margin-right: 0.5rem;
}

.main .ms .ms_0 .ms_3 {
background: #e43130;
border-radius: 5px;
color: aliceblue;
margin-right: 0.1rem;
}
.main .ms .right {
color: #e43130;
font-size: 1rem;
}
.main .tp {
display: flex;
justify-content: space-evenly;
align-items: center;
}
.main .tp .tp_1 {
text-align: center;
width: 5rem;
height: 5rem;
}
.main .tp .tp_1 img {
height: 100%;
width: 100%;
}
.main .tp .tp_1 .iconfont:first-of-type {
color: #e43130;
font-size: 1.5rem;
font-weight: bolder;
}
.main .tp .tp_1 .iconfont:last-of-type {
color: rgb(138, 138, 132);
font-size: 1rem;
text-decoration-line: line-through;
}

/ 小导航 /
.main .nav {
display: flex;
flex-flow: row wrap;
padding: 1rem;
}
.main .nav .nav_1 {
flex: 1 1 20%;
display: flex;
flex-flow: column nowrap;
align-items: center;
margin-bottom: 1.5rem;
font-size: 1.3rem;
}
.main .nav .nav_1 img {
width: 4rem;
height: 4rem;
}

更多相关文章

  1. 7/30号作业
  2. 简单表单与css选择器实战案例
  3. 注册表单实战案例
  4. HTML注册表单控件实例、CSS模块化理解与CSS基本/上下文选择器的
  5. css语法介绍
  6. 【记账小程序】收入和支出首页展示与数字键功能、编辑后端分类列
  7. 选择器的使用和模块化组件思想
  8. TP6之分页实战
  9. 百度蜘蛛ip地址大全,百度搜索引擎蜘蛛的IP地址段

随机推荐

  1. Android selector背景选择器 用法汇总
  2. 学习Android studio 个人总结小经验
  3. Android有用代码(一)
  4. Learning Android(第一季)01-Android平台一
  5. Android入门教程 sharedpreferences的用
  6. Android(安卓)HAL 开发 (1)
  7. ConstraintLayout子View android:minHeig
  8. Android之screenOrientation和configChan
  9. Android中 ToggleButton【状态切换按钮】
  10. Android(安卓)开发四大天王 四大组件 (很