博客列表 >flex实战2(12.26作业)+ PHP培训十期线上班

flex实战2(12.26作业)+ PHP培训十期线上班

弃
原创
2019年12月28日 01:19:40736浏览

商品列表展示

html代码展示

  1. <!--
  2. * @Descripttion:
  3. * @version:
  4. * @Author: pengpeng
  5. * @Date: 2019-12-27 13:31:35
  6. * @LastEditors : pengpeng
  7. * @LastEditTime : 2019-12-27 17:59:29
  8. -->
  9. <!DOCTYPE html>
  10. <html lang="en">
  11. <head>
  12. <meta charset="UTF-8">
  13. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  14. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  15. <link rel="stylesheet" href="./demo.css">
  16. <title>二手交易</title>
  17. </head>
  18. <body>
  19. <div class="public-shop">
  20. <div class="public-shop-title1">
  21. <a href="javascript:;">抢好货</a>
  22. <span>0低价、便捷安全、快速</span>
  23. </div>
  24. <div class="public-shop-title2">
  25. <span>热门分类</span>
  26. <a href="javascript:;">美女写真</a>
  27. <a href="javascript:;">美女写真</a>
  28. <a href="javascript:;">美女写真</a>
  29. <a href="javascript:;">美女写真</a>
  30. <a href="javascript:;">美女写真</a>
  31. </div>
  32. <div class="public-shop-list">
  33. <div class="public-shop-list-show">
  34. <div class="shop-img">
  35. <a href=""><img src="/public/static/images/img7.jpg" alt=""></a>
  36. <a>美女性感写真海报艺术装饰滴滴滴滴滴滴滴....</a>
  37. <div>
  38. <span>&yen;</span>
  39. <span>美女</span>
  40. </div>
  41. </div>
  42. <div class="shop-img">
  43. <a href=""><img src="/public/static/images/img7.jpg" alt=""></a>
  44. <a>美女性感写真海报艺术装饰滴滴滴滴滴滴滴....</a>
  45. <div>
  46. <span>&yen;</span>
  47. <span>美女</span>
  48. </div>
  49. </div>
  50. <div class="shop-img">
  51. <a href=""><img src="/public/static/images/img7.jpg" alt=""></a>
  52. <a>美女性感写真海报艺术装饰滴滴滴滴滴滴滴....</a>
  53. <div>
  54. <span>&yen;</span>
  55. <span>美女</span>
  56. </div>
  57. </div>
  58. <div class="shop-img">
  59. <a href=""><img src="/public/static/images/img7.jpg" alt=""></a>
  60. <a>美女性感写真海报艺术装饰滴滴滴滴滴滴滴....</a>
  61. <div>
  62. <span>&yen;</span>
  63. <span>美女</span>
  64. </div>
  65. </div>
  66. <div class="shop-img">
  67. <a href=""><img src="/public/static/images/img7.jpg" alt=""></a>
  68. <a>美女性感写真海报艺术装饰滴滴滴滴滴滴滴....</a>
  69. <div>
  70. <span>&yen;</span>
  71. <span>美女</span>
  72. </div>
  73. </div>
  74. <div class="shop-img">
  75. <a href=""><img src="/public/static/images/img7.jpg" alt=""></a>
  76. <a>美女性感写真海报艺术装饰滴滴滴滴滴滴滴....</a>
  77. <div>
  78. <span>&yen;</span>
  79. <span>美女</span>
  80. </div>
  81. </div>
  82. <div class="shop-img">
  83. <a href=""><img src="/public/static/images/img7.jpg" alt=""></a>
  84. <a>美女性感写真海报艺术装饰滴滴滴滴滴滴滴....</a>
  85. <div>
  86. <span>&yen;</span>
  87. <span>美女</span>
  88. </div>
  89. </div>
  90. <div class="shop-img">
  91. <a href=""><img src="/public/static/images/img7.jpg" alt=""></a>
  92. <a>美女性感写真海报艺术装饰滴滴滴滴滴滴滴....</a>
  93. <div>
  94. <span>&yen;</span>
  95. <span>美女</span>
  96. </div>
  97. </div>
  98. </div>
  99. <div class="shop-list-money">
  100. <div>
  101. <a href=""><img src="/public/static/images/ad/1.png" alt=""></a>
  102. <a href=""><img src="/public/static/images/ad/1.png" alt=""></a>
  103. <a href=""><img src="/public/static/images/ad/1.png" alt=""></a>
  104. <a href=""><img src="/public/static/images/ad/1.png" alt=""></a>
  105. </div>
  106. <a href=""><img src="/public/static/images/ad/image.png" alt=""></a>
  107. <a href=""><img src="/public/static/images/ad/ad2.jpg" alt=""></a>
  108. </div>
  109. </div>
  110. </div>
  111. </body>
  112. </html>

css代码展示

  1. /* 初始化 */
  2. @import url(../public/_public.css);
  3. .public-shop{
  4. width: 1200px;
  5. border: 1px solid #978b8b;
  6. box-sizing: border-box;
  7. border-radius: 5px;
  8. margin: auto;
  9. background-color: #fff;
  10. padding: 10px;
  11. }
  12. .public-shop:hover{
  13. box-shadow: 0 0 8px #888;
  14. }
  15. .public-shop > .public-shop-title1{
  16. height: 50px;
  17. border-bottom: 1px solid #cccccc;
  18. }
  19. .public-shop > .public-shop-title1 > a{
  20. font-size: 23px;
  21. font-weight: bolder;
  22. margin-right: 20px;
  23. }
  24. .public-shop > .public-shop-title1 > span{
  25. color: red;
  26. }
  27. .public-shop > .public-shop-title2{
  28. height: 55px;
  29. }
  30. .public-shop > .public-shop-title2 > span{
  31. color: red;
  32. font-size: 25px;
  33. }
  34. .public-shop > .public-shop-title2 > span ~ a{
  35. padding-left: 10px;
  36. }
  37. .public-shop > .public-shop-title2 > span ~ a:hover{
  38. color: chocolate;
  39. }
  40. .public-shop > .public-shop-list{
  41. height: 440px;
  42. display: flex;
  43. flex-flow: row nowrap;
  44. }
  45. .public-shop > .public-shop-list > .public-shop-list-show{
  46. flex-basis: 800px;
  47. padding: 10px;
  48. flex-flow: row wrap;
  49. display: flex;
  50. justify-content: space-between;
  51. }
  52. .public-shop > .public-shop-list > .public-shop-list-show > .shop-img{
  53. width: 178px;
  54. height: 200px;
  55. flex-flow: column nowrap;
  56. display: flex;
  57. justify-content: space-between;
  58. }
  59. .public-shop > .public-shop-list > .public-shop-list-show > .shop-img img{
  60. width: 176px;
  61. height: 120px;
  62. border-radius: 5px;
  63. }
  64. .public-shop > .public-shop-list > .public-shop-list-show > .shop-img div{
  65. display:flex;
  66. }
  67. .public-shop > .public-shop-list > .public-shop-list-show > .shop-img div > span:first-of-type{
  68. color:red;
  69. }
  70. .public-shop > .public-shop-list > .public-shop-list-show > .shop-img div > span:last-of-type{
  71. background-color: cyan;
  72. color: white;
  73. margin-left: auto;
  74. padding: 0 5px;
  75. }
  76. .public-shop > .public-shop-list > .shop-list-money{
  77. flex-basis: 400px;
  78. padding: 10px ;
  79. /* box-sizing: border-box; */
  80. display: flex;
  81. flex-flow: row wrap;
  82. justify-content: space-between;
  83. }
  84. .public-shop > .public-shop-list > .shop-list-money > div img{
  85. width: 190px;
  86. height: 130px;
  87. }
  88. .public-shop > .public-shop-list > .shop-list-money > div{
  89. display:flex;
  90. flex-flow: row wrap;
  91. justify-content: space-around;
  92. }
  93. .public-shop > .public-shop-list > .shop-list-money > a > img{
  94. width: 393px;
  95. height: 60px;
  96. }

评论与回复

html代码展示

  1. <!--
  2. * @Descripttion:
  3. * @version:
  4. * @Author: pengpeng
  5. * @Date: 2019-12-27 23:59:20
  6. * @LastEditors : pengpeng
  7. * @LastEditTime : 2019-12-28 00:58:09
  8. -->
  9. <!DOCTYPE html>
  10. <html lang="en">
  11. <head>
  12. <meta charset="UTF-8">
  13. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  14. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  15. <link rel="stylesheet" href="./demo1.css">
  16. <link rel="stylesheet" href="/public/static/font/iconfont.css">
  17. <title>Document</title>
  18. </head>
  19. <body>
  20. <div class="public-comment">
  21. <div class="public-comment-write">
  22. <span>我要评论</span>
  23. <div>
  24. <label for="write"><img src="/public/static/images/user.png" alt=""></label>
  25. <textarea name="" id="write" cols="30" rows="10"></textarea>
  26. </div>
  27. <button>发表评论</button>
  28. </div>
  29. <div class="public-comment-read">
  30. <span>最新回复</span>
  31. <div>
  32. <img src="/public/static/images/user.png" alt="">
  33. <div class="read-comment">
  34. <span>用户昵称</span>
  35. <span>好多酱油好多好多酱油好多酱油</span>
  36. <div>
  37. <span>xxxx-xx-xx xx:xx:xx发表</span>
  38. <span><em class="iconfont icon-dianzan"></em>回复</span>
  39. </div>
  40. </div>
  41. </div>
  42. <div>
  43. <img src="/public/static/images/user.png" alt="">
  44. <div class="read-comment">
  45. <span>用户昵称</span>
  46. <span>好多酱油好多好多酱油好多酱油</span>
  47. <div>
  48. <span>xxxx-xx-xx xx:xx:xx发表</span>
  49. <span><em class="iconfont icon-dianzan"></em>回复</span>
  50. </div>
  51. </div>
  52. </div>
  53. <div>
  54. <img src="/public/static/images/user.png" alt="">
  55. <div class="read-comment">
  56. <span>用户昵称</span>
  57. <span>好多酱油好多好多酱油好多酱油</span>
  58. <div>
  59. <span>xxxx-xx-xx xx:xx:xx发表</span>
  60. <span><em class="iconfont icon-dianzan"></em>回复</span>
  61. </div>
  62. </div>
  63. </div>
  64. <div>
  65. <img src="/public/static/images/user.png" alt="">
  66. <div class="read-comment">
  67. <span>用户昵称</span>
  68. <span>好多酱油好多好多酱油好多酱油</span>
  69. <div>
  70. <span>xxxx-xx-xx xx:xx:xx发表</span>
  71. <span><em class="iconfont icon-dianzan"></em>回复</span>
  72. </div>
  73. </div>
  74. </div>
  75. <div>
  76. <img src="/public/static/images/user.png" alt="">
  77. <div class="read-comment">
  78. <span>用户昵称</span>
  79. <span>好多酱油好多好多酱油好多酱油</span>
  80. <div>
  81. <span>xxxx-xx-xx xx:xx:xx发表</span>
  82. <span><em class="iconfont icon-dianzan"></em>回复</span>
  83. </div>
  84. </div>
  85. </div>
  86. <div>
  87. <img src="/public/static/images/user.png" alt="">
  88. <div class="read-comment">
  89. <span>用户昵称</span>
  90. <span>好多酱油好多好多酱油好多酱油</span>
  91. <div>
  92. <span>xxxx-xx-xx xx:xx:xx发表</span>
  93. <span><em class="iconfont icon-dianzan"></em>回复</span>
  94. </div>
  95. </div>
  96. </div>
  97. <div>
  98. <img src="/public/static/images/user.png" alt="">
  99. <div class="read-comment">
  100. <span>用户昵称</span>
  101. <span>好多酱油好多好多酱油好多酱油</span>
  102. <div>
  103. <span>xxxx-xx-xx xx:xx:xx发表</span>
  104. <span><em class="iconfont icon-dianzan"></em>回复</span>
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </body>
  111. </html>

css代码展示

  1. /* 初始化 */
  2. @import url(../public/_public.css);
  3. .public-comment{
  4. margin: 20px;
  5. border-top: 1px solid #cccccc;
  6. }
  7. .public-comment > .public-comment-write{
  8. padding: 10px;
  9. box-sizing: border-box;
  10. display:flex;
  11. flex-flow: column nowrap;
  12. }
  13. .public-comment > .public-comment-write > span{
  14. font-size: 20px;
  15. font-weight: bolder;
  16. padding: 5px 0;
  17. }
  18. .public-comment > .public-comment-write > div{
  19. margin-top: 20px;
  20. display: flex;
  21. }
  22. .public-comment > .public-comment-write > div > label{
  23. padding-left: 20px;
  24. }
  25. .public-comment > .public-comment-write > div img{
  26. width: 70px;
  27. }
  28. .public-comment > .public-comment-write > div textarea{
  29. height: 200px;
  30. padding: 10px;
  31. box-sizing: border-box;
  32. font-size: 20px;
  33. color: saddlebrown;
  34. margin-left: 20px;
  35. border: none;
  36. border-radius: 10px;
  37. resize: none;
  38. flex: 1;
  39. }
  40. .public-comment > .public-comment-write > div textarea:hover{
  41. box-shadow: 0 0 8px lightpink;
  42. }
  43. .public-comment > .public-comment-write > button{
  44. border: none;
  45. width: 100px;
  46. height: 50px;
  47. font-size: 17px;
  48. border-radius: 10px;
  49. align-self: flex-end;
  50. background-color: yellow;
  51. margin-top: 10px;
  52. }
  53. .public-comment > .public-comment-write > button:hover{
  54. background-color: red;
  55. }
  56. .public-comment > .public-comment-read{
  57. margin-top: 20px;
  58. display: flex;
  59. flex-flow: column;
  60. }
  61. .public-comment > .public-comment-read > span{
  62. font-size: 20px;
  63. font-weight: bolder;
  64. padding: 10px;
  65. }
  66. .public-comment > .public-comment-read > div{
  67. display: flex;
  68. margin: 10px 0;
  69. }
  70. .public-comment > .public-comment-read > div > img{
  71. width: 60px;
  72. padding: 20px 10px;
  73. }
  74. .public-comment > .public-comment-read > div > div{
  75. flex: 1;
  76. display: flex;
  77. flex-flow: column nowrap;
  78. justify-content: space-between;
  79. padding: 5px;
  80. }
  81. .public-comment > .public-comment-read > div > div > div{
  82. display: flex;
  83. justify-content: space-between;
  84. }
  85. .public-comment > .public-comment-read > div > div > div:last-of-type em{
  86. color: red;
  87. margin-right: 5px;
  88. }

思路总结

  1. 首先先看一遍视频,知道页面的大致逻辑
  2. 把整个页面划分成小块,规划哪些地方能用到flex
  3. 将小块结合成大块,就形成页面

布局中遇到的问题

  1. 不知道页面元素的大小,每次都要翻视频去看
  2. 虽然页面看上去是差不多了,但是相比对与老师的代码,有些地方就是不同,反正就是看上去怪怪的。
  3. 没有写注释,请老师指点一下。
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议