博客列表 >Flex实现二手交易与评论功能

Flex实现二手交易与评论功能

荔枝哥哥
荔枝哥哥原创
2019年12月29日 22:41:59661浏览

Flex实现二手交易与评论功能

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <link rel="stylesheet" href="./job_1.css">
  8. <title>二手组件</title>
  9. </head>
  10. <body>
  11. <!-- 引入大标题组件 -->
  12. <div class="public-headline">
  13. <span>二手交易</span>
  14. </div>
  15. <!-- 二手交易区 -->
  16. <div class="public-second-hand">
  17. <!-- 标题1 -->
  18. <div class="title1">
  19. <a href="">抢好货</a>
  20. <span> 0低价, 便捷,安全,快速</span>
  21. </div>
  22. <div class="title2">
  23. <span>热门分类</span>
  24. <a href="">美女写真</a>
  25. <a href="">日本美女</a>
  26. <a href="">美国美女</a>
  27. <a href="">国内美女</a>
  28. <a href="">神奇女侠</a>
  29. </div>
  30. <!-- 商品展示区 -->
  31. <div class="goods">
  32. <!--1 商品列表 -->
  33. <div class="goods-list">
  34. <!-- 商品简介1 -->
  35. <div class="intro">
  36. <a href=""><img src="./1226/static/images/shop/shop1.jpg" alt="" width="176" height="120"></a>
  37. <a href="">美女性感写真海报墙艺术装饰画贴画图1</a>
  38. <div>
  39. <span>&yen;333</span>
  40. <span>美女</span>
  41. </div>
  42. </div>
  43. <div class="intro">
  44. <a href=""><img src="./1226/static/images/shop/shop2.jpg" alt="" ></a>
  45. <a href="">美女性感写真海报墙艺术装饰画贴画图1</a>
  46. <div>
  47. <span>&yen;333</span>
  48. <span>美女</span>
  49. </div>
  50. </div>
  51. <div class="intro">
  52. <a href=""><img src="./1226/static/images/shop/shop3.jpg" alt=""></a>
  53. <a href="">美女性感写真海报墙艺术装饰画贴画图1</a>
  54. <div>
  55. <span>&yen;333</span>
  56. <span>美女</span>
  57. </div>
  58. </div>
  59. <div class="intro">
  60. <a href=""><img src="./1226/static/images/shop/shop4.jpg" alt=""></a>
  61. <a href="">美女性感写真海报墙艺术装饰画贴画图1</a>
  62. <div>
  63. <span>&yen;333</span>
  64. <span>美女</span>
  65. </div>
  66. </div>
  67. <div class="intro">
  68. <a href=""><img src="./1226/static/images/shop/shop5.jpg" alt=""></a>
  69. <a href="">美女性感写真海报墙艺术装饰画贴画图1</a>
  70. <div>
  71. <span>&yen;333</span>
  72. <span>美女</span>
  73. </div>
  74. </div>
  75. <div class="intro">
  76. <a href=""><img src="./1226/static/images/shop/shop6.jpg" alt=""></a>
  77. <a href="">美女性感写真海报墙艺术装饰画贴画图1</a>
  78. <div>
  79. <span>&yen;333</span>
  80. <span>美女</span>
  81. </div>
  82. </div>
  83. <div class="intro">
  84. <a href=""><img src="./1226/static/images/shop/shop7.jpg" alt=""></a>
  85. <a href="">美女性感写真海报墙艺术装饰画贴画图1</a>
  86. <div>
  87. <span>&yen;333</span>
  88. <span>美女</span>
  89. </div>
  90. </div>
  91. <div class="intro">
  92. <a href=""><img src="./1226/static/images/shop/shop8.jpg" alt=""></a>
  93. <a href="">美女性感写真海报墙艺术装饰画贴画图1</a>
  94. <div>
  95. <span>&yen;333</span>
  96. <span>美女</span>
  97. </div>
  98. </div>
  99. </div>
  100. <!-- 右侧快速入口 -->
  101. <div class="quick-entry">
  102. <a href=""><img src="./1226/static/images/ad/1.png" alt=""></a>
  103. <a href=""><img src="./1226/static/images/ad/2.png" alt=""></a>
  104. <a href=""><img src="./1226/static/images/ad/3.png" alt=""></a>
  105. <a href=""><img src="./1226/static/images/ad/4.png" alt=""></a>
  106. <div>
  107. <a href=""><img src="./1226/static/images/ad/image.png" alt=""></a>
  108. <a href=""><img src="./1226/static/images/ad/ad2.jpg" alt=""></a>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. </body>
  114. </html>
  1. /*样式重置*/
  2. @import "./job_reset.css";
  3. /*大标题组件*/
  4. @import "./job_headline.css";
  5. /* 二手交易专区的样式表 */
  6. .public-second-hand{
  7. width: 1200px;
  8. padding: 10px;
  9. box-sizing: border-box;
  10. margin: auto;
  11. border-radius: 5px;
  12. background-color: #fff;
  13. }
  14. /* 阴影效果 */
  15. .public-second-hand:hover{
  16. box-shadow: 0 0 8px #888;
  17. }
  18. /* 标题1 */
  19. .public-second-hand > .title1{
  20. height: 50px;
  21. border-bottom: 1px solid #cccccc;
  22. box-sizing: border-box;
  23. }
  24. .public-second-hand > .title1 > a{
  25. font-size: 23px;
  26. margin-right: 20px;
  27. }
  28. .public-second-hand > .title1 > span{
  29. color: red;
  30. }
  31. /* 标题2 */
  32. .public-second-hand > .title2 {
  33. height: 55px;
  34. }
  35. .public-second-hand > .title2 > span{
  36. color: red;
  37. font-size: 23px;
  38. }
  39. .public-second-hand > .title2 > span ~ a{
  40. padding-left: 20px;
  41. }
  42. .public-second-hand > .title2 > span ~ a:hover {
  43. color: lightcoral;
  44. }
  45. /* 商品展示区 */
  46. .public-second-hand > .goods {
  47. height: 440px;
  48. /* 转换为弹性布局 */
  49. display: flex;
  50. }
  51. .public-second-hand > .goods > .goods-list{
  52. padding: 10px;
  53. flex-basis: 800px;
  54. display: flex;
  55. flex-flow: row wrap;
  56. justify-content: space-between;
  57. }
  58. .public-second-hand > .goods > .goods-list > .intro{
  59. width: 178px;
  60. height: 200px;
  61. display: flex;
  62. flex-flow: column nowrap;
  63. justify-content: space-between;
  64. }
  65. .public-second-hand > .goods > .goods-list > .intro img{
  66. width: 176px;
  67. height: 120px;
  68. border: 1px solid #cccccc;
  69. border-radius: 5px;
  70. }
  71. .public-second-hand > .goods > .goods-list > .intro span:first-of-type {
  72. color: red;
  73. }
  74. .public-second-hand > .goods > .goods-list > .intro > div {
  75. display: flex;
  76. }
  77. .public-second-hand > .goods > .goods-list > .intro span:last-of-type {
  78. color: white;
  79. background-color: #55ce9f;
  80. padding: 0 5px;
  81. margin-left: auto;
  82. }
  83. /* 功能快速入口区 */
  84. .public-second-hand > .goods > .quick-entry{
  85. flex-basis: 400px;
  86. padding: 10px;
  87. display: flex;
  88. flex-flow: row wrap;
  89. justify-content: space-between;
  90. }
  91. .public-second-hand > .goods > .quick-entry img{
  92. width: 190px;
  93. height: 130px;
  94. }
  95. .public-second-hand > .goods > .quick-entry > div {
  96. width: 400px;
  97. display: flex;
  98. flex-direction: column;
  99. }
  100. .public-second-hand > .goods > .quick-entry > div img {
  101. width: 393px;
  102. height: 60px;
  103. }

second-hand

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <link rel="stylesheet" href="./1226/static/font/iconfont.css">
  8. <link rel="stylesheet" href="job_2.css">
  9. <title>评论与回复组件</title>
  10. </head>
  11. <body>
  12. <div class="public-comment-reply">
  13. <!-- 评论区 -->
  14. <div class="comment">
  15. <h3>我要评论</h3>
  16. <div>
  17. <label for="comment"><img src="./1226/static/images/user.png" alt=""></label>
  18. <textarea name="" id="comment"></textarea>
  19. </div>
  20. <button>发表评论</button>
  21. </div>
  22. <!-- 回复区 -->
  23. <div class="reply">
  24. <h3>最新回复</h3>
  25. <div>
  26. <img src="./1226/static/images/user.png" alt="">
  27. <div class="detail">
  28. <span>用户昵称</span>
  29. <span>留言内容: php中文网,是一个有温度,有思想的学习平台</span>
  30. <div>
  31. <span>2019-12-29 22:03:11发表</span>
  32. <span><i class="iconfont icon-dianzan"></i>回复</span>
  33. </div>
  34. </div>
  35. </div>
  36. <div>
  37. <img src="./1226/static/images/user.png" alt="">
  38. <div class="detail">
  39. <span>用户昵称</span>
  40. <span>留言内容: php中文网,是一个有温度,有思想的学习平台</span>
  41. <div>
  42. <span>2019-12-29 22:03:11发表</span>
  43. <span><i class="iconfont icon-dianzan"></i>回复</span>
  44. </div>
  45. </div>
  46. </div>
  47. <div>
  48. <img src="./1226/static/images/user.png" alt="">
  49. <div class="detail">
  50. <span>用户昵称</span>
  51. <span>留言内容: php中文网,是一个有温度,有思想的学习平台</span>
  52. <div>
  53. <span>2019-12-29 22:03:11发表</span>
  54. <span><i class="iconfont icon-dianzan"></i>回复</span>
  55. </div>
  56. </div>
  57. </div>
  58. <div>
  59. <img src="./1226/static/images/user.png" alt="">
  60. <div class="detail">
  61. <span>用户昵称</span>
  62. <span>留言内容: php中文网,是一个有温度,有思想的学习平台</span>
  63. <div>
  64. <span>2019-12-29 22:03:11发表</span>
  65. <span><i class="iconfont icon-dianzan"></i>回复</span>
  66. </div>
  67. </div>
  68. </div>
  69. <div>
  70. <img src="./1226/static/images/user.png" alt="">
  71. <div class="detail">
  72. <span>用户昵称</span>
  73. <span>留言内容: php中文网,是一个有温度,有思想的学习平台</span>
  74. <div>
  75. <span>2019-12-29 22:03:11发表</span>
  76. <span><i class="iconfont icon-dianzan"></i>回复</span>
  77. </div>
  78. </div>
  79. </div>
  80. <div>
  81. <img src="./1226/static/images/user.png" alt="">
  82. <div class="detail">
  83. <span>用户昵称</span>
  84. <span>留言内容: php中文网,是一个有温度,有思想的学习平台</span>
  85. <div>
  86. <span>2019-12-29 22:03:11发表</span>
  87. <span><i class="iconfont icon-dianzan"></i>回复</span>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </body>
  94. </html>
  1. @import url(./job_reset.css);
  2. .public-comment-reply{
  3. padding: 15px;
  4. box-sizing: border-box;
  5. background-color: #fff;
  6. display: flex;
  7. flex-direction: column;
  8. }
  9. .public-comment-reply img{
  10. width: 60px;
  11. height: 60px;
  12. border-radius: 5px;
  13. box-shadow: 1px 1px 3px #cccccc;
  14. }
  15. .public-comment-reply > .comment{
  16. display: flex;
  17. flex-direction: column;
  18. }
  19. .public-comment-reply > .comment h3{
  20. padding: 20px 0;
  21. border-top: 1px solid #cccccc;
  22. }
  23. .public-comment-reply > .comment > div{
  24. padding: 15px;
  25. height: 200px;
  26. display: flex;
  27. flex-flow: row nowrap;
  28. }
  29. .public-comment-reply > .comment > div img{
  30. align-self: flex-start;
  31. }
  32. .public-comment-reply > .comment > div textarea{
  33. height: 200px;
  34. margin-left: 20px;
  35. /* 输入框大小不可以拖动 */
  36. resize: none;
  37. flex: auto;
  38. }
  39. .public-comment-reply > .comment > div textarea:hover{
  40. box-shadow: 0 0 8px #888888;
  41. }
  42. .public-comment-reply > .comment > button{
  43. font-size: 14px;
  44. background-color: #f64c59;
  45. border: none;
  46. color: white;
  47. width: 150px;
  48. height: 40px;
  49. align-self: flex-end;
  50. }
  51. .public-comment-reply > .comment > button:hover{
  52. background-color: #178cee;
  53. box-shadow: 0 0 8px #888888;
  54. cursor: pointer;
  55. }
  56. /* 回复区 */
  57. .public-comment-reply > .reply{
  58. display: flex;
  59. flex-direction: column;
  60. padding: 15px 0;
  61. }
  62. .public-comment-reply > .reply > h3{
  63. padding: 20px 0;
  64. }
  65. .public-comment-reply > .reply > div{
  66. display: flex;
  67. margin-top: 30px;
  68. }
  69. .public-comment-reply > .reply > div > img{
  70. align-self: center;
  71. }
  72. .public-comment-reply > .reply > div > .detail{
  73. flex: auto;
  74. display: flex;
  75. flex-direction: column;
  76. margin-left: 20px;
  77. height: 90px;
  78. justify-content: space-between;
  79. }
  80. .public-comment-reply > .reply > div > .detail >div{
  81. display: flex;
  82. justify-content: space-between;
  83. }
  84. .public-comment-reply > .reply > div > .detail >div i{
  85. color: red;
  86. font-size: 1.2rem;
  87. margin-right: 5px;
  88. }

comment-reply

总结

拿到界面时先整体规划好思路,画好多少个弹性盒子,怎么布局会更容易让flex发挥他的最优方式

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议