博客列表 >2019-12-29 留言及评论(Grid实现)-PHP培训十期

2019-12-29 留言及评论(Grid实现)-PHP培训十期

ys899
ys899原创
2019年12月30日 19:59:02600浏览

```HTML Code DOM结构 素材库已备齐
<!DOCTYPE html>

<html lang="en">

<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="../../../static/font/iconfont.css">
<link rel="stylesheet" href="public_comment_reply_grid.css">
<title>评论与回复组件</title>
</head>

<body>

<div class="public-comment-reply">
<!--评论区-->
<div class="comment">
<h3>我要评论</h3>
<div>
<label for="commment">
<img src="../../../static/images/user.png" alt="">
</label>
<textarea name="" id="commment"></textarea>
</div>
<button>发表评论</button>
</div>

  1. <!--回复区-->
  2. <div class="reply">
  3. <h3>最新回复</h3>
  4. <div>
  5. <img src="../../../static/images/user.png" alt="">
  6. <div class="detail">
  7. <span>用户昵称</span>
  8. <span>留言内容: php中文网,是一个有温度,有思想的学习平台</span>
  9. <div>
  10. <span>2019-12-12 15:34:23发表</span>
  11. <span><i class="iconfont icon-dianzan"></i>回复</span>
  12. </div>
  13. </div>
  14. </div>
  15. <div>
  16. <img src="../../../static/images/user.png" alt="">
  17. <div class="detail">
  18. <span>用户昵称</span>
  19. <span>留言内容: php中文网,是一个有温度,有思想的学习平台</span>
  20. <div>
  21. <span>2019-12-12 15:34:23发表</span>
  22. <span><i class="iconfont icon-dianzan"></i>回复</span>
  23. </div>
  24. </div>
  25. </div>
  26. <div>
  27. <img src="../../../static/images/user.png" alt="">
  28. <div class="detail">
  29. <span>用户昵称</span>
  30. <span>留言内容: php中文网,是一个有温度,有思想的学习平台</span>
  31. <div>
  32. <span>2019-12-12 15:34:23发表</span>
  33. <span><i class="iconfont icon-dianzan"></i>回复</span>
  34. </div>
  35. </div>
  36. </div>
  37. <div>
  38. <img src="../../../static/images/user.png" alt="">
  39. <div class="detail">
  40. <span>用户昵称</span>
  41. <span>留言内容: php中文网,是一个有温度,有思想的学习平台</span>
  42. <div>
  43. <span>2019-12-12 15:34:23发表</span>
  44. <span><i class="iconfont icon-dianzan"></i>回复</span>
  45. </div>
  46. </div>
  47. </div>
  48. </div>

</div>
</body>
</html>

  1. ```CSS Code Grid布局
  2. @import url(../public_reset.css);
  3. .public-comment-reply {
  4. padding: 15px;
  5. box-sizing: border-box;
  6. background-color: #fff;
  7. display: grid;
  8. /*flex-direction: column;*/
  9. }
  10. .public-comment-reply img {
  11. width: 60px;
  12. height: 60px;
  13. border-radius: 5px;
  14. box-shadow: 1px 1px 3px #cccccc;
  15. }
  16. .public-comment-reply > .comment {
  17. display: flex;
  18. flex-direction: column;
  19. }
  20. .public-comment-reply > .comment h3 {
  21. padding: 20px 0;
  22. border-top: 1px solid #cccccc;
  23. }
  24. .public-comment-reply > .comment > div {
  25. padding: 15px;
  26. height: 200px;
  27. display: flex;
  28. flex-flow: row nowrap;
  29. }
  30. .public-comment-reply > .comment > div img {
  31. align-self: flex-start;
  32. }
  33. .public-comment-reply > .comment > div textarea {
  34. height: 200px;
  35. margin-left: 20px;
  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: 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. }

效果图

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