博客列表 >CSS基础flex实战二手商品列表、评论与回复-PHP培训十期线上班 学号:510251 12月26日作业

CSS基础flex实战二手商品列表、评论与回复-PHP培训十期线上班 学号:510251 12月26日作业

赵大叔
赵大叔原创
2019年12月28日 16:06:25841浏览

flex项目实战


flex项目实战一-公共二手交易区

1、大标题

引用大标题组件:

复制html代码 导入CSS样式


2、二手交易区


2.1 标题1

<a>链接 + <span>文本


2.2 标题2

<span>文本 +5个<a>链接

2.2 商品展示区

2.2.1 商品列表

商品列表中商品简介分为:
1.可点击图片<a>+<img>
2.可点击文本<a>
3.价格、标签两个元素放一个div中,水平排列
PS:此三项目垂直排列

2.2.2 功能入口

1.四张可点击图片<a>+<img>水平排列
2.div内两张可点击图片<a>+<img>垂直排列
PS 此两项目垂直排列

flex项目实战一-公共二手交易区HTML代码

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <link rel="stylesheet" href="public_second_hand.css">
  6. <title>公共二手交易区组件</title>
  7. </head>
  8. <body>
  9. <!--引入大标题组件,复制代码 -->
  10. <div class="public-headerline">
  11. <span>二手交易</span>
  12. </div>
  13. <!--二手交易区-->
  14. <div class="public-second-hand">
  15. <!-- 标题1-->
  16. <div class="title1">
  17. <a href="">抢好货</a>
  18. <span>0低价,便捷,安全,快速</span>
  19. </div>
  20. <!-- 标题2-->
  21. <div class="title2">
  22. <span>热门分类</span>
  23. <a href="">美女写真</a>
  24. <a href="">日本美女</a>
  25. <a href="">美国美女</a>
  26. <a href="">国内美女</a>
  27. <a href="">AV美女</a>
  28. </div>
  29. <!-- 商品展示区-->
  30. <div class="goods">
  31. <!-- 商品列表-->
  32. <div class="goods-list">
  33. <!-- 商品简介-->
  34. <div class="intro">
  35. <a href=""><img src="../../../static/images/shop/shop1.jpg" alt="" width="176" height="120"></a>
  36. <a href="">美女性感写真海报墙艺术装饰画贴画图1</a>
  37. <div>
  38. <span>¥ 333</span>
  39. <span>美女</span>
  40. </div>
  41. </div>
  42. <div class="intro">
  43. <a href=""><img src="../../../static/images/shop/shop2.jpg" alt="" width="176" height="120"></a>
  44. <a href="">美女性感写真海报墙艺术装饰画贴画图1</a>
  45. <div>
  46. <span>¥ 333</span>
  47. <span>美女</span>
  48. </div>
  49. </div>
  50. <div class="intro">
  51. <a href=""><img src="../../../static/images/shop/shop3.jpg" alt="" width="176" height="120"></a>
  52. <a href="">美女性感写真海报墙艺术装饰画贴画图1</a>
  53. <div>
  54. <span>¥ 333</span>
  55. <span>美女</span>
  56. </div>
  57. </div>
  58. <div class="intro">
  59. <a href=""><img src="../../../static/images/shop/shop4.jpg" alt="" width="176" height="120"></a>
  60. <a href="">美女性感写真海报墙艺术装饰画贴画图1</a>
  61. <div>
  62. <span>¥ 333</span>
  63. <span>美女</span>
  64. </div>
  65. </div>
  66. <div class="intro">
  67. <a href=""><img src="../../../static/images/shop/shop5.jpg" alt="" width="176" height="120"></a>
  68. <a href="">美女性感写真海报墙艺术装饰画贴画图1</a>
  69. <div>
  70. <span>¥ 333</span>
  71. <span>美女</span>
  72. </div>
  73. </div>
  74. <div class="intro">
  75. <a href=""><img src="../../../static/images/shop/shop6.jpg" alt="" width="176" height="120"></a>
  76. <a href="">美女性感写真海报墙艺术装饰画贴画图1</a>
  77. <div>
  78. <span>¥ 333</span>
  79. <span>美女</span>
  80. </div>
  81. </div>
  82. <div class="intro">
  83. <a href=""><img src="../../../static/images/shop/shop7.jpg" alt="" width="176" height="120"></a>
  84. <a href="">美女性感写真海报墙艺术装饰画贴画图1</a>
  85. <div>
  86. <span>¥ 333</span>
  87. <span>美女</span>
  88. </div>
  89. </div>
  90. <div class="intro">
  91. <a href=""><img src="../../../static/images/shop/shop8.jpg" alt="" width="176" height="120"></a>
  92. <a href="">美女性感写真海报墙艺术装饰画贴画图1</a>
  93. <div>
  94. <span>¥ 333</span>
  95. <span>美女</span>
  96. </div>
  97. </div>
  98. </div>
  99. <!-- 右侧功能区快速入口-->
  100. <div class="quick-entry">
  101. <a href=""><img src="../../../static/images/ad/1.png" alt=""></a>
  102. <a href=""><img src="../../../static/images/ad/1.png" alt=""></a>
  103. <a href=""><img src="../../../static/images/ad/1.png" alt=""></a>
  104. <a href=""><img src="../../../static/images/ad/1.png" alt=""></a>
  105. <div>
  106. <a href=""><img src="../../../static/images/ad/image.png" alt=""></a>
  107. <a href=""><img src="../../../static/images/ad/ad2.jpg" alt=""></a>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. </body>
  113. </html>

flex项目实战一-公共二手交易区CSS代码

  1. /*样式重置*/
  2. @import "../public_reset.css";
  3. /*引入大标题组件样式 */
  4. @import "../public_headline/public_headerline.css";
  5. /*二手区基本样式*/
  6. .public-second-hand {
  7. width: 1200px;
  8. padding: 10px;
  9. /*居中*/
  10. margin: auto;
  11. box-sizing: border-box;
  12. /*阴影*/
  13. border-radius: 5px;
  14. background-color: #ffffff;
  15. }
  16. 鼠标悬停样式
  17. .public-second-hand:hover{
  18. box-shadow: 0 0 8px #888;
  19. }
  20. /*标题1*/
  21. .pubic-second-hand > title1{
  22. height: 50px;
  23. box-sizing: border-box;
  24. /*下边框,solid实线*/
  25. border-bottom: 1px solid #cccccc;
  26. }
  27. .public-second-hand > title1 > a{
  28. font-size: 23px;
  29. /*抢好货右边距*/
  30. margin-right: 20px;
  31. }
  32. .public-second-hand > .title1 > span{
  33. /*span内文本颜色*/
  34. color: red;
  35. }
  36. /*标题2*/
  37. .public-second-hand > .title2{
  38. height: 55px;
  39. }
  40. .public-second-hand > .title2 > span{
  41. font-size: 23px;
  42. color: red;
  43. }
  44. .public-second-hand > .title2 > span ~a{
  45. /*标签间间隔*/
  46. padding-left: 20px;
  47. }
  48. /*商品展示区*/
  49. .public-second-hand>.goods{
  50. height: 440px;
  51. display: flex;
  52. }
  53. /*商品列表*/
  54. .public-second-hand>.goods>.goods-list{
  55. padding: 10px;
  56. /*项目宽度*/
  57. flex-basis: 800px;
  58. display: flex;
  59. flex-flow: row wrap;
  60. /*项目主轴两端对齐*/
  61. justify-content: space-between;
  62. }
  63. .public-second-hand>.goods>.goods-list>.intro{
  64. width: 178px;
  65. height: 200px;
  66. display: flex;
  67. flex-flow: column nowrap;
  68. justify-content: space-between;
  69. }
  70. .public-second-hand>.goods>.goods-list>.intro img{
  71. /*边框*/
  72. border: 1px solid #cccccc;
  73. /*圆角*/
  74. border-radius: 5px;
  75. }
  76. .public-second-hand>.goods>.goods-list>.intro span:first-of-type{
  77. /*价格颜色*/
  78. color: red;
  79. }
  80. .public-second-hand>.goods>.goods-list>.intro > div{
  81. display: flex;
  82. }
  83. .public-second-hand>.goods>.goods-list>.intro span:last-of-type{
  84. /*美女文字标签*/
  85. color: white;
  86. background-color: #55ce9f;
  87. padding: 0 5px;
  88. margin-left: auto;
  89. }
  90. .public-second-hand>.goods>.quick-entry{
  91. flex-basis: 400px;
  92. padding: 10px;
  93. display: flex;
  94. flex-flow: row wrap;
  95. justify-content: space-between;
  96. }
  97. .public-second-hand>.goods>.quick-entry img{
  98. width: 190px;
  99. height: 130px;
  100. }
  101. .public-second-hand>.goods>.quick-entry > div{
  102. width: 400px;
  103. display: flex;
  104. flex-direction: column;
  105. }
  106. .public-second-hand>.goods>.quick-entry > div img{
  107. width: 393px;
  108. height: 60px;
  109. }

flex项目实战一-公共二手交易区效果图



flex项目实战二——评论与发贴

1、评论区

1.1 标题

<h3>标题


1.2 文本框

头像img
文本域textarea
作为一个<div>块,绑定label,实现点击自动焦点


1.3 提交按钮

<button>


2、回复区

2.1 标题

<h3>标题


2.2

头像<img>和 1个<div>块,放1个div块中水平排列。此<div>块又包含两个<span>文本和1个<div>块垂直排列。最后这个<div>中又包含一个<span>文本和一个字体图标,水平排列。

flex项目实战二——评论与发贴HTML代码

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <!-- 导入字体图标-->
  6. <link rel="stylesheet" href="../../../static/font/iconfont.css">
  7. <link rel="stylesheet" href="public_comment_reply.css">
  8. <title>评论发帖</title>
  9. </head>
  10. <body>
  11. <div class="public-comment-reply">
  12. <div class="comment">
  13. <h3>我要评论</h3>
  14. <div>
  15. <!-- 头像,文本域,作为一个块,绑定label,实现点击,自动焦点-->
  16. <label for="comment"><img src="../../../static/images/user.png" alt=""></label>
  17. <textarea name="" id="comment"></textarea>
  18. </div>
  19. <button>发表评论</button>
  20. </div>
  21. <div class="reply">
  22. <h3>最新回复</h3>
  23. <div>
  24. <img src="../../../static/images/user.png" alt="">
  25. <div class="detail">
  26. <span>用户昵称</span>
  27. <span>留言内容:php中文网,是一个有温度,有思想的学习平台</span>
  28. <div>
  29. <span>2019-12-27 15:34:23 发表</span>
  30. <span><i class="iconfont icon-dianzan"></i>回复</span>
  31. </div>
  32. </div>
  33. </div>
  34. <div>
  35. <img src="../../../static/images/user.png" alt="">
  36. <div class="detail">
  37. <span>用户昵称</span>
  38. <span>留言内容:php中文网,是一个有温度,有思想的学习平台</span>
  39. <div>
  40. <span>2019-12-27 15:34:23 发表</span>
  41. <span><i class="iconfont icon-dianzan"></i>回复</span>
  42. </div>
  43. </div>
  44. </div>
  45. <div>
  46. <img src="../../../static/images/user.png" alt="">
  47. <div class="detail">
  48. <span>用户昵称</span>
  49. <span>留言内容:php中文网,是一个有温度,有思想的学习平台</span>
  50. <div>
  51. <span>2019-12-27 15:34:23 发表</span>
  52. <span><i class="iconfont icon-dianzan"></i>回复</span>
  53. </div>
  54. </div>
  55. </div>
  56. <div>
  57. <img src="../../../static/images/user.png" alt="">
  58. <div class="detail">
  59. <span>用户昵称</span>
  60. <span>留言内容:php中文网,是一个有温度,有思想的学习平台</span>
  61. <div>
  62. <span>2019-12-27 15:34:23 发表</span>
  63. <span><i class="iconfont icon-dianzan"></i>回复</span>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </body>
  70. </html>

flex项目实战二——评论与发贴CSS代码

  1. /*初始化样式*/
  2. @import "../public_reset.css";
  3. .public-comment-reply{
  4. padding: 15px;
  5. box-sizing: border-box;
  6. background-color: #fff;
  7. display: flex;
  8. flex-direction: column;
  9. }
  10. .public-comment-reply img{
  11. /*阴影*/
  12. box-shadow: 1px 1px 3px #cccccc;
  13. /*圆角*/
  14. border-radius: 5px;
  15. }
  16. .public-comment-reply > .comment{
  17. display: flex;
  18. flex-direction: column;
  19. }
  20. .public-comment-reply img{
  21. width: 60px;
  22. height: 60px;
  23. }
  24. .public-comment-reply > .comment h3{
  25. padding: 20px 0;
  26. /*我要评论上有个上边线*/
  27. border-top: 1px solid #cccccc;
  28. }
  29. .public-comment-reply > .comment > div{
  30. padding: 15px;
  31. height: 200px;
  32. display: flex;
  33. flex-flow: row nowrap;
  34. }
  35. .public-comment-reply > .comment > div img{
  36. /*单独设置头像在交叉轴上左对齐*/
  37. align-self: start;
  38. }
  39. .public-comment-reply > .comment > div textarea{
  40. height: 200px;
  41. margin-left: 20px;
  42. resize:none; /*禁止缩放*/
  43. flex: auto;
  44. }
  45. .public-comment-reply > .comment > div textarea:hover{
  46. box-shadow: 0 0 8px #888;
  47. }
  48. .public-comment-reply > .comment > button{
  49. font-size: 14px;
  50. background-color: #f64c59;
  51. border: none;
  52. color: white;
  53. width: 150px;
  54. height: 40px;
  55. align-self: end;
  56. }
  57. .public-comment-reply > .comment > button:hover{
  58. background-color: #178cee;
  59. box-shadow: 0 0 5px #888;
  60. }
  61. .public-comment-reply > .reply {
  62. display: flex;
  63. flex-direction: column;
  64. padding: 15px;
  65. }
  66. .public-comment-reply > .reply > h3{
  67. padding: 20px 0;
  68. }
  69. .public-comment-reply > .reply > div{
  70. display: flex;
  71. margin-top: 30px;
  72. }
  73. .public-comment-reply > .reply > div > img{
  74. align-self: center;
  75. }
  76. .public-comment-reply > .reply > div .detail{
  77. flex: auto;
  78. display: flex;
  79. flex-direction: column;
  80. margin-left: 20px;
  81. height: 90px;
  82. justify-content: space-between;
  83. }
  84. .public-comment-reply > .reply > div .detail > div{
  85. display: flex;
  86. flex-direction: row;
  87. justify-content: space-between;
  88. }
  89. .public-comment-reply > .reply > div .detail > div i{
  90. color: red;
  91. font-size: 1.2rem;
  92. margin-right: 5px;
  93. }

flex项目实战二——评论与发贴效果图

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