Blogger Information
Blog 7
fans 0
comment 0
visits 4338
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
1226作业
建国
Original
636 people have browsed it

培训内容

flex实战

作业

目录结构

  1. |-components_self
  2. | |-public_comment_reply
  3. | | |-public_comment_reply.css
  4. | |
  5. | |-public_exercise_1226
  6. | | |-public_exercise_1226.css
  7. | | |-public_exercise_1226.html
  8. | |
  9. | |-public_headline
  10. | | |-public_headline.css
  11. | |
  12. | |-public_second_hand
  13. | | |-public_second_hand.css
  14. | |
  15. | |-public_reset.css
  16. |
  17. |-static

代码部分

public_comment_reply.css

  1. @import "../public_reset.css";
  2. .public-comment-reply{
  3. display: flex;
  4. flex-direction: column;
  5. padding: 20px;
  6. width: 1200px;
  7. margin: auto;
  8. }
  9. .public-comment-reply > .title {
  10. border-top:1px solid #cccccc;
  11. }
  12. .public-comment-reply .title {
  13. line-height: 50px;
  14. font-size: 20px;
  15. font-weight: bold;
  16. }
  17. .public-comment-reply > .reply{
  18. display: flex;
  19. flex-direction: column;
  20. margin-bottom: 20px;
  21. }
  22. .public-comment-reply > .reply > div{
  23. display: flex;
  24. margin-bottom: 10px;
  25. }
  26. .public-comment-reply > .reply > div > label{
  27. align-self: flex-start;
  28. }
  29. .public-comment-reply > .reply > div > textarea{
  30. flex:1;
  31. height:200px;
  32. margin-left:20px;
  33. border:1px solid #cccccc;
  34. border-radius: 5px;
  35. padding: 10px;
  36. resize: none;
  37. }
  38. .public-comment-reply > .reply > div > label > img{
  39. align-self: center;
  40. }
  41. .public-comment-reply img{
  42. width: 60px;
  43. height: 60px;
  44. border-radius: 5px;
  45. box-shadow: 0 0 5px #888888;
  46. }
  47. .public-comment-reply > .reply > button {
  48. width: 150px;
  49. height: 40px;
  50. border:none;
  51. background-color: #f64c59;
  52. color:white;
  53. border-radius: 5px;
  54. cursor: pointer;
  55. }
  56. .public-comment-reply > .comment > .comment-list > .detail{
  57. display: flex;
  58. margin-bottom: 20px;
  59. }
  60. .public-comment-reply > .comment > .comment-list > .detail >img{
  61. align-self: center;
  62. }
  63. .public-comment-reply > .comment > .comment-list >.detail > div{
  64. margin-left:20px;
  65. flex: 1;
  66. display: flex;
  67. flex-direction: column;
  68. justify-content: space-between;
  69. height: 90px;
  70. }
  71. .public-comment-reply > .comment > .comment-list >.detail > div > div{
  72. display: flex;
  73. justify-content: space-between;
  74. }
  75. .public-comment-reply > .comment > .comment-list >.detail > div > div > :first-child{
  76. color:#888888;
  77. }
  78. .public-comment-reply > .comment > .comment-list >.detail > div > div > :last-child{
  79. font-size: 14px;
  80. }
  81. .public-comment-reply > .comment > .comment-list >.detail > div > div > :last-child > i{
  82. color:red;
  83. margin-right: 10px;
  84. font-size: 18px;
  85. }

public_exercise_1226.css

  1. /*样式初始化*/
  2. @import "../public_reset.css";
  3. /*引入大标题*/
  4. @import "../public_headline/public_headline.css";
  5. /*引入二手交易区*/
  6. @import "../public_second_hand/public_second_hand.css";
  7. /*引入回复评论区*/
  8. @import "../public_comment_reply/public_comment_reply.css";

public_exercise_1226.html

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <link rel="stylesheet" href="./public_exercise_1226.css">
  6. <link rel="stylesheet" href="../../static/font/iconfont.css">
  7. <title>12月26日作业</title>
  8. </head>
  9. <body>
  10. <!--大标题-->
  11. <div class="public_headline">
  12. <span>二手交易</span>
  13. </div>
  14. <!--二手交易区-->
  15. <div class="public-second-hand">
  16. <!-- 标题-->
  17. <div class="title">
  18. <a href="">抢好货</a>
  19. <span>0低价, 便捷,安全,快速</span>
  20. </div>
  21. <!--标题2-->
  22. <div class="title2">
  23. <span>热门分类</span>
  24. <div>
  25. <li>美女写真</li>
  26. <li>日本美女</li>
  27. <li>美国美女</li>
  28. <li>国内美女</li>
  29. <li>AV美女</li>
  30. </div>
  31. </div>
  32. <!-- 商品展示-->
  33. <div class="goods">
  34. <div class="list">
  35. <div class="detail">
  36. <a href=""><img src="../../static/images/shop/shop1.jpg" alt=""></a>
  37. <a href="">美女性感写真海报墙艺术装饰画贴画图1</a>
  38. <div>
  39. <span>&yen;333</span>
  40. <span>美女</span>
  41. </div>
  42. </div>
  43. <div class="detail">
  44. <a href=""><img src="../../static/images/shop/shop2.jpg" alt=""></a>
  45. <a href="">美女性感写真海报墙艺术装饰画贴画图2</a>
  46. <div>
  47. <span>&yen;333</span>
  48. <span>美女</span>
  49. </div>
  50. </div>
  51. <div class="detail">
  52. <a href=""><img src="../../static/images/shop/shop3.jpg" alt=""></a>
  53. <a href="">美女性感写真海报墙艺术装饰画贴画图3</a>
  54. <div>
  55. <span>&yen;333</span>
  56. <span>美女</span>
  57. </div>
  58. </div>
  59. <div class="detail">
  60. <a href=""><img src="../../static/images/shop/shop4.jpg" alt=""></a>
  61. <a href="">美女性感写真海报墙艺术装饰画贴画图4</a>
  62. <div>
  63. <span>&yen;333</span>
  64. <span>美女</span>
  65. </div>
  66. </div>
  67. <div class="detail">
  68. <a href=""><img src="../../static/images/shop/shop5.jpg" alt=""></a>
  69. <a href="">美女性感写真海报墙艺术装饰画贴画图5</a>
  70. <div>
  71. <span>&yen;333</span>
  72. <span>美女</span>
  73. </div>
  74. </div>
  75. <div class="detail">
  76. <a href=""><img src="../../static/images/shop/shop6.jpg" alt=""></a>
  77. <a href="">美女性感写真海报墙艺术装饰画贴画图6</a>
  78. <div>
  79. <span>&yen;333</span>
  80. <span>美女</span>
  81. </div>
  82. </div>
  83. <div class="detail">
  84. <a href=""><img src="../../static/images/shop/shop7.jpg" alt=""></a>
  85. <a href="">美女性感写真海报墙艺术装饰画贴画图7</a>
  86. <div>
  87. <span>&yen;333</span>
  88. <span>美女</span>
  89. </div>
  90. </div>
  91. <div class="detail">
  92. <a href=""><img src="../../static/images/shop/shop8.jpg" alt=""></a>
  93. <a href="">美女性感写真海报墙艺术装饰画贴画图8</a>
  94. <div>
  95. <span>&yen;333</span>
  96. <span>美女</span>
  97. </div>
  98. </div>
  99. </div>
  100. <div class="quick-entry">
  101. <a><img src="../../static/images/ad/1.png" alt=""></a>
  102. <a><img src="../../static/images/ad/2.png" alt=""></a>
  103. <a><img src="../../static/images/ad/3.png" alt=""></a>
  104. <a><img src="../../static/images/ad/4.png" alt=""></a>
  105. <div>
  106. <img src="../../static/images/ad/image.png" alt="">
  107. <img src="../../static/images/ad/ad2.jpg" alt="">
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. <!--回复评论区-->
  113. <div class="public-comment-reply">
  114. <div class="title">我要评论</div>
  115. <div class="reply">
  116. <div>
  117. <label for="reply"><img src="../../static/images/user.png" alt=""></label>
  118. <textarea name="" id="reply"></textarea>
  119. </div>
  120. <button>发表评论</button>
  121. </div>
  122. <div class="comment">
  123. <div class="title">最新回复</div>
  124. <div class="comment-list">
  125. <div class="detail">
  126. <img src="../../static/images/user.png" alt="">
  127. <div>
  128. <span>用户昵称</span>
  129. <span>留言内容: php中文网,是一个有温度,有思想的学习平台</span>
  130. <div>
  131. <span>2019-12-12 15:34:23发表</span>
  132. <span><i class="iconfont icon-dianzan"></i>回复</span>
  133. </div>
  134. </div>
  135. </div>
  136. <div class="detail">
  137. <img src="../../static/images/user.png" alt="">
  138. <div>
  139. <span>用户昵称</span>
  140. <span>留言内容: php中文网,是一个有温度,有思想的学习平台</span>
  141. <div>
  142. <span>2019-12-12 15:34:23发表</span>
  143. <span><i class="iconfont icon-dianzan"></i>回复</span>
  144. </div>
  145. </div>
  146. </div>
  147. <div class="detail">
  148. <img src="../../static/images/user.png" alt="">
  149. <div>
  150. <span>用户昵称</span>
  151. <span>留言内容: php中文网,是一个有温度,有思想的学习平台</span>
  152. <div>
  153. <span>2019-12-12 15:34:23发表</span>
  154. <span><i class="iconfont icon-dianzan"></i>回复</span>
  155. </div>
  156. </div>
  157. </div>
  158. <div class="detail">
  159. <img src="../../static/images/user.png" alt="">
  160. <div>
  161. <span>用户昵称</span>
  162. <span>留言内容: php中文网,是一个有温度,有思想的学习平台</span>
  163. <div>
  164. <span>2019-12-12 15:34:23发表</span>
  165. <span><i class="iconfont icon-dianzan"></i>回复</span>
  166. </div>
  167. </div>
  168. </div>
  169. </div>
  170. </div>
  171. </div>
  172. </body>
  173. </html>

public_headline.css

  1. @import "../public_reset.css";
  2. .public_headline{
  3. width: 1200px;
  4. margin:auto;
  5. display: flex;
  6. justify-content: center;
  7. }
  8. .public_headline > span{
  9. font-size: 30px;
  10. font-weight: bold;
  11. line-height: 50px;
  12. border-bottom: 3px solid red;
  13. }

public_second_hand.css

  1. @import "../public_reset.css";
  2. .public-second-hand{
  3. width: 1200px;
  4. display: flex;
  5. flex-direction: column;
  6. background-color: #fff;
  7. border-radius: 5px;
  8. box-shadow: 0 0 8px #888888;
  9. margin:20px auto;
  10. padding: 20px;
  11. box-sizing: border-box;
  12. }
  13. .public-second-hand > .title{
  14. display: flex;
  15. border-bottom: 1px solid #cccccc;
  16. padding-bottom: 20px;
  17. }
  18. .public-second-hand > .title > a{
  19. font-size: 24px;
  20. }
  21. .public-second-hand > .title > a:hover{
  22. color:red;
  23. }
  24. .public-second-hand >.title>span{
  25. color:red;
  26. margin-left:20px;
  27. align-self: flex-end;
  28. }
  29. .public-second-hand > .title2{
  30. display: flex;
  31. padding-top: 10px;
  32. margin-bottom: 20px;
  33. }
  34. .public-second-hand > .title2 > span{
  35. font-size: 24px;
  36. color:red;
  37. }
  38. .public-second-hand > .title2 > div{
  39. display: flex;
  40. align-self: flex-end;
  41. }
  42. .public-second-hand > .title2 > div > li{
  43. margin:0 10px;
  44. font-size: 16px;
  45. }
  46. .public-second-hand > .goods{
  47. display: flex;
  48. flex-direction:row;
  49. height: 440px;
  50. }
  51. .public-second-hand > .goods > .list{
  52. flex-basis: 800px;
  53. display: flex;
  54. flex-flow: row wrap;
  55. justify-content: space-between;
  56. padding-right: 5px;
  57. align-content: space-between;
  58. }
  59. .public-second-hand > .goods > .list > .detail{
  60. flex-basis: 178px;
  61. display: flex;
  62. flex-direction: column;
  63. align-items: center;
  64. justify-content: space-between;
  65. height: 200px;
  66. }
  67. .public-second-hand > .goods > .list > .detail img{
  68. width: 176px;
  69. height: 120px;
  70. border-radius: 5px;
  71. }
  72. .public-second-hand > .goods > .list > .detail > div{
  73. display: flex;
  74. justify-content: space-between;
  75. width: 100%;
  76. }
  77. .public-second-hand > .goods > .list > .detail > div > :first-child{
  78. color:red;
  79. }
  80. .public-second-hand > .goods > .list > .detail > div > :last-child{
  81. background-color: #55ce9f;
  82. padding:0 3px;
  83. border-radius: 2px;
  84. color:white;
  85. }
  86. .public-second-hand > .goods > .quick-entry{
  87. display: flex;
  88. flex-basis: 400px;
  89. padding-left: 5px;
  90. flex-flow: row wrap;
  91. justify-content: space-between;
  92. }
  93. .public-second-hand > .goods > .quick-entry > a >img{
  94. width: 190px;
  95. height: 130px;
  96. }
  97. .public-second-hand > .goods > .quick-entry > div{
  98. display: flex;
  99. flex-direction: column;
  100. justify-content: space-between;
  101. }
  102. .public-second-hand > .goods > .quick-entry > div > img{
  103. width: 393px;
  104. height: 60px;
  105. border-radius: 5px;
  106. }

public_reset.css

  1. * {
  2. margin: 0;
  3. padding: 0;
  4. /*参考线 */
  5. /* outline: 1px dashed red;*/
  6. }
  7. body {
  8. font-size: 13px;
  9. color: #555555;
  10. background-color: #efefef;
  11. }
  12. a {
  13. color: #404040;
  14. text-decoration: none;
  15. font-size: 13px;
  16. }
  17. li {
  18. list-style: none;
  19. }

总结

  1. 尺寸参考老师的尺寸,大部分布局也参考了老师的布局,只有评论列表区考虑到内容多少不固定、条数也不一定是固定的,所以直接采用了原始的布局方式,直接排下来了
  2. 因为要上班(平时使用tp做后端开发,刚从tp3转到tp6,还在连学习边开发中),所以空余时间比较少,所以很多细节没有仔细琢磨,并没有对老师不尊重,希望老师不要见怪
  3. 最后说一句:flex确实挺好用

效果图

Correcting teacher:天蓬老师天蓬老师

Correction status:qualified

Teacher's comments:完成的不错, 下次注意二点: 1. 作业标题要体现内容 2. 代码要有注释
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