Blogger Information
Blog 20
fans 0
comment 0
visits 11671
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
1.flex项目上的三个属性、2。移动商城
愿情的博客
Original
507 people have browsed it

一.flex项目上的三个属性

  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>项目上的flex属性</title>
  8. <style>
  9. * {
  10. box-sizing: ;
  11. }
  12. :foot {
  13. font-size: 10px;
  14. }
  15. body {
  16. font-size: 1.6rem;
  17. }
  18. /* flex容器 */
  19. .container {
  20. display: flex;
  21. height: 20rem;
  22. border: 1px solid black;
  23. }
  24. /* /项目样式: */
  25. .container > .item {
  26. width: 10rem;
  27. /* max-width: 10rem; */
  28. background-color: lightcyan;
  29. border: 1px solid black;
  30. /* 设置项目是否允许放大 */
  31. /* flex-grow: 1; */
  32. /* 设置项目是否允许收缩 */
  33. /* flex-shrink: 0; */
  34. /* 设置项目在主轴空间的大小 */
  35. /* flex-basis: 15rem; */
  36. /* max-width>flex-basis>width */
  37. /* flex: 放大因子 收缩因子 计算大小; */
  38. /* flex: 1 0 15rem; */
  39. }
  40. /* flex属性 */
  41. .container .item {
  42. /* flex:默认值,禁止放大,允许缩小。宽度自动 */
  43. /* flex: 0 1 auto; */
  44. /* flex: initial; */
  45. /* 允许放大与收缩 */
  46. /* flex: 1 1 auto; */
  47. /* flex: auto; */
  48. /* 完全失去弹性:禁止放大和收缩 ,用于pc端 */
  49. /* flex: 0 0 auto; */
  50. /* flex: none; */
  51. /* 单值:仅表示是否放大 */
  52. /* flex: 1; */
  53. /* flex: auto; */
  54. /* felx: 2; */
  55. /* flex: 300; */
  56. /*无任何效果 */
  57. }
  58. .container > .item:first-of-type {
  59. background-color: yellow;
  60. /* flex: 1 1 auto; */
  61. flex: 1;
  62. }
  63. .container > .item:first-of-type + * {
  64. background-color: green;
  65. /* flex: 2 1 auto; */
  66. flex: 2;
  67. }
  68. .container > .item:last-of-type {
  69. background-color: orange;
  70. /* flex: 1 1 auto; */
  71. flex: 1;
  72. }
  73. </style>
  74. </head>
  75. <body>
  76. <div class="container">
  77. <div class="item">item1</div>
  78. <div class="item">item2</div>
  79. <div class="item">item3</div>
  80. <!-- <div class="item">item4</div> -->
  81. </div>
  82. </body>
  83. </html>

align-self属性

  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>项目上的align-self属性</title>
  8. <style>
  9. * {
  10. box-sizing: ;
  11. }
  12. :foot {
  13. font-size: 10px;
  14. }
  15. body {
  16. font-size: 1.6rem;
  17. }
  18. /* flex容器 */
  19. .container {
  20. display: flex;
  21. height: 20rem;
  22. border: 1px solid black;
  23. /* 设置所有的项目在交叉轴上的对齐方式 */
  24. /* align-items: ; */
  25. }
  26. .container > .item {
  27. width: 10rem;
  28. /* max-width: 10rem; */
  29. background-color: lightcyan;
  30. border: 1px solid black;
  31. }
  32. .item.three {
  33. background-color: yellow;
  34. align-self: stretch;
  35. align-self: flex-end;
  36. align-self: flex-start;
  37. align-self: center;
  38. }
  39. .container {
  40. position: relative;
  41. }
  42. .container > .item:nth-of-type(3) {
  43. position: relative;
  44. left: 5rem;
  45. }
  46. </style>
  47. </head>
  48. <body>
  49. <div class="container">
  50. <div class="item">item1</div>
  51. <div class="item">item2</div>
  52. <div class="item three">item3</div>
  53. <div class="item">item4</div>
  54. </div>
  55. </body>
  56. </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>项目上的align-self属性</title>
  8. <style>
  9. * {
  10. box-sizing: ;
  11. }
  12. :foot {
  13. font-size: 10px;
  14. }
  15. body {
  16. font-size: 1.6rem;
  17. }
  18. /* flex容器 */
  19. .container {
  20. display: flex;
  21. height: 20rem;
  22. border: 1px solid black;
  23. }
  24. .container > .item {
  25. width: 10rem;
  26. /* max-width: 10rem; */
  27. background-color: lightcyan;
  28. border: 1px solid black;
  29. order: 0;
  30. }
  31. .item.one {
  32. background-color: teal;
  33. order: 90;
  34. }
  35. .item.two {
  36. background-color: thistle;
  37. }
  38. .item.three {
  39. background-color: tomato;
  40. order: -1;
  41. }
  42. .item.four {
  43. background-color: turquoise;
  44. }
  45. /* order的值越小越靠前。越大越靠后 */
  46. </style>
  47. </head>
  48. <body>
  49. <div class="container">
  50. <div class="item one">item1</div>
  51. <div class="item two">item2</div>
  52. <div class="item three">item3</div>
  53. <div class="item four">item4</div>
  54. </div>
  55. </body>
  56. </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>页眉+页脚+主导航+秒杀区+推荐商品列表区</title>
  8. <link rel="stylesheet" href="static/icon-font/iconfont.css" />
  9. <link rel="stylesheet" href="static/css/index.css" />
  10. <link rel="stylesheet" href="static//css/header.css" />
  11. <link rel="stylesheet" href="static/css/footer.css" />
  12. <link rel="stylesheet" href="static/css/nav.css" />
  13. <link rel="stylesheet" href="static/css/ms.css" />
  14. <link rel="stylesheet" href="static/css/tj.css" />
  15. <!-- <link rel="stylesheet" href="static/css/reset.css" /> -->
  16. </head>
  17. <body>
  18. <div class="header">
  19. <!-- 菜单 -->
  20. <div class="menu iconfont icon-menu"></div>
  21. <!-- 搜索框 -->
  22. <div class="search">
  23. <div class="logo">JD</div>
  24. <div class="zoom iconfont icon-search"></div>
  25. <input type="text" class="words" value="移动硬盘500g" />
  26. </div>
  27. <!-- 登录 -->
  28. <a href="" class="login">登录</a>
  29. </div>
  30. <div class="main">
  31. <!-- 主导航 -->
  32. <ul class="nav">
  33. <li>
  34. <a href=""><img src="static/images/dh/nav-1.png" alt=""></a>
  35. <a href="">京东超市</a>
  36. </li>
  37. <li>
  38. <a href=""><img src="static/images/dh/nav-2.png" alt=""></a>
  39. <a href="">数码电器</a>
  40. </li>
  41. <li>
  42. <a href=""><img src="static/images/dh/nav-3.png" alt=""></a>
  43. <a href="">京东服饰</a>
  44. </li>
  45. <li>
  46. <a href=""><img src="static/images/dh/nav-4.png" alt=""></a>
  47. <a href="">京东生鲜</a>
  48. </li>
  49. <li>
  50. <a href=""><img src="static/images/dh/nav-5.png" alt=""></a>
  51. <a href="">京东缴费</a>
  52. </li>
  53. <li>
  54. <a href=""><img src="static/images/dh/nav-6.png" alt=""></a>
  55. <a href="">充值缴费</a>
  56. </li>
  57. <li>
  58. <a href=""><img src="static/images/dh/nav-7.png" alt=""></a>
  59. <a href="">9.9元拼</a>
  60. </li>
  61. <li>
  62. <a href=""><img src="static/images/dh/nav-8.png" alt=""></a>
  63. <a href="">领卷</a>
  64. </li>
  65. <li>
  66. <a href=""><img src="static/images/dh/nav-9.png" alt=""></a>
  67. <a href="">领金贴</a>
  68. </li>
  69. <li>
  70. <a href=""><img src="static/images/dh/nav-10.png" alt=""></a>
  71. <a href="">PLUS会员</a>
  72. </li>
  73. </ul>
  74. <div class="ms" >
  75. <!-- 秒杀区 -->
  76. <div class="ms-top">
  77. <div class="left">
  78. <div class="title">京东秒杀</div>
  79. <div class="notice">
  80. <div class="tips">20点专场</div>
  81. <div class="time">20:00: 00</div>
  82. </div>
  83. </div>
  84. <div class="right">更多秒杀</div>
  85. </div>
  86. <!-- 主体秒杀区 -->
  87. <ul class="ms-body">
  88. <li class="item">
  89. <a href=""><img src="static/images/ms/ms-3.jpg" alt=""></a>
  90. <div class="iconfont icon-rmb">338</div>
  91. <div class="iconfont icon-rmb">558</div>
  92. </li>
  93. <li class="item">
  94. <a href=""><img src="static/images/ms/ms-3.jpg" alt=""></a>
  95. <div class="iconfont icon-rmb">338</div>
  96. <div class="iconfont icon-rmb">558</div>
  97. </li>
  98. <li class="item">
  99. <a href=""><img src="static/images/ms/ms-3.jpg" alt=""></a>
  100. <div class="iconfont icon-rmb">338</div>
  101. <div class="iconfont icon-rmb">558</div>
  102. </li>
  103. <li class="item">
  104. <a href=""><img src="static/images/ms/ms-4.jpg" alt=""></a>
  105. <div class="iconfont icon-rmb">338</div>
  106. <div class="iconfont icon-rmb">558</div>
  107. </li>
  108. </ul>
  109. </div>
  110. <!-- 推荐商品列表区 -->
  111. <ul class="tj">
  112. <li class="item">
  113. <a href=""><img src="static/images/sp/sp-1.webp" alt="" /></a>
  114. <p>商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍</p>
  115. <div class="price">
  116. <div class="iconfont icon-rmb">138</div>
  117. <!-- <div>满减</div> -->
  118. <div>看相似</div>
  119. </div>
  120. </li>
  121. <li class="item">
  122. <a href=""><img src="static/images/sp/sp-2.webp" alt="" /></a>
  123. <p>商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介品介绍商品介绍
  124. </p>
  125. <div class="price">
  126. <div class="iconfont icon-rmb">203</div>
  127. <!-- <div>满减</div> -->
  128. <div>看相似</div>
  129. </div>
  130. </li>
  131. <li class="item">
  132. <a href=""><img src="static/images/sp/sp-3.webp" alt="" /></a>
  133. <p>商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介品介绍商品介绍</p>
  134. <div class="price">
  135. <div class="iconfont icon-rmb">203</div>
  136. <!-- <div>满减</div> -->
  137. <div>看相似</div>
  138. </div>
  139. </li>
  140. <li class="item">
  141. <a href=""><img src="static/images/sp/sp-4.webp" alt="" /></a>
  142. <p>商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介品介绍商品介绍</p>
  143. <div class="price">
  144. <div class="iconfont icon-rmb">203</div>
  145. <!-- <div>满减</div> -->
  146. <div>看相似</div>
  147. </div>
  148. </li>
  149. <li class="item">
  150. <a href=""><img src="static/images/sp/sp-5.webp" alt="" /></a>
  151. <p>商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介品介绍商品介绍</p>
  152. <div class="price">
  153. <div class="iconfont icon-rmb">203</div>
  154. <!-- <div>满减</div> -->
  155. <div>看相似</div>
  156. </div>
  157. </li>
  158. <li class="item">
  159. <a href=""><img src="static/images/sp/sp-6.webp" alt="" /></a>
  160. <p>商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介绍商品介品介绍商品介绍</p>
  161. <div class="price">
  162. <div class="iconfont icon-rmb">203</div>
  163. <!-- <div>满减</div> -->
  164. <div>看相似</div>
  165. </div>
  166. </li>
  167. </ul>
  168. </div>
  169. <div class="footer">
  170. <div>
  171. <div class="iconfont icon-home"></div>
  172. <span>首页</span>
  173. </div>
  174. <div>
  175. <div class="iconfont icon-home"></div>
  176. <span>分类</span>
  177. </div>
  178. <div>
  179. <div class="iconfont icon-home"></div>
  180. <span>惊喜<span>
  181. </div>
  182. <div>
  183. <div class="iconfont icon-home"></div>
  184. <span>购物车</span>
  185. </div>
  186. <div>
  187. <div class="iconfont icon-home"></div>
  188. <span>未登录</span>
  189. </div>
  190. </div>
  191. </body>
  192. </html>
Correcting teacher:天蓬老师天蓬老师

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!