Blogger Information
Blog 22
fans 0
comment 0
visits 11785
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
flex实战-Php第十期线上班
Original
438 people have browsed it

2019.12.26作业

先分析网页有哪些元素,创建html文档写出dom结构,再在css文档中写出dom结构的样式,这样就完成一个完整的组件。

二手交易页面


这个页面分为上下两部分,上面是页面标题,已在2019.12.25课堂上完成,现将在下面商品展示部分完成。
商品展示分为上面的广告标题,中间的分类依据下面的图片展示,其中图片展示又分为左右两个部分。
这里面需要运用到flex容器中再添加flex容器完成下面图片部分的布局。


代码如下

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <link rel="stylesheet" href="public_second_hand.css">
  6. <!-- <link rel="stylesheet" href="../public_headline/public_headline.css">-->
  7. <title>public_second_hand</title>
  8. </head>
  9. <body>
  10. <!-- 大标题-->
  11. <div class="public_headline">
  12. <span>二手交易</span>
  13. </div>
  14. <!--二手交易区-->
  15. <div class="public_second_hand">
  16. <!-- 标题1-->
  17. <div class="title1">
  18. <a href="">抢好货</a>
  19. <span>0低价,便捷,安全,快速</span>
  20. </div>
  21. <!-- 标题2-->
  22. <div class="title2">
  23. <span>热门分类</span>
  24. <a href="">写真</a>
  25. <a href="">America</a>
  26. <a href="">Japan</a>
  27. <a href="">China</a>
  28. <a href="">Video</a>
  29. </div>
  30. <!-- 商品展示区-->
  31. <div class="goods">
  32. <!-- 1.左侧商品列表-->
  33. <div class="goods_list">
  34. <!-- 商品简介-->
  35. <div class="intro">
  36. <a href=""><img src="../../../../static/images/shop/shop1.jpg" alt="" width="176" height="120"></a>
  37. <a href="">写真</a>
  38. <div class="price">
  39. <span>&yen; 333</span>
  40. <span>beauty</span>
  41. </div>
  42. </div>
  43. <div class="intro">
  44. <a href=""><img src="../../../../static/images/shop/shop2.jpg" alt="" width="176" height="120"></a>
  45. <a href="">写真1</a>
  46. <div class="price">
  47. <span>&yen; 333</span>
  48. <span>beauty</span>
  49. </div>
  50. </div>
  51. <div class="intro">
  52. <a href=""><img src="../../../../static/images/shop/shop3.jpg" alt="" width="176" height="120"></a>
  53. <a href="">写真1</a>
  54. <div class="price">
  55. <span>&yen; 333</span>
  56. <span>beauty</span>
  57. </div>
  58. </div>
  59. <div class="intro">
  60. <a href=""><img src="../../../../static/images/shop/shop4.jpg" alt="" width="176" height="120"></a>
  61. <a href="">写真1</a>
  62. <div class="price">
  63. <span>&yen; 333</span>
  64. <span>beauty</span>
  65. </div>
  66. </div>
  67. <div class="intro">
  68. <a href=""><img src="../../../../static/images/shop/shop5.jpg" alt="" width="176" height="120"></a>
  69. <a href="">写真1</a>
  70. <div class="price">
  71. <span>&yen; 333</span>
  72. <span>beauty</span>
  73. </div>
  74. </div>
  75. <div class="intro">
  76. <a href=""><img src="../../../../static/images/shop/shop6.jpg" alt="" width="176" height="120"></a>
  77. <a href="">写真1</a>
  78. <div class="price">
  79. <span>&yen; 333</span>
  80. <span>beauty</span>
  81. </div>
  82. </div>
  83. <div class="intro">
  84. <a href=""><img src="../../../../static/images/shop/shop7.jpg" alt="" width="176" height="120"></a>
  85. <a href="">写真1</a>
  86. <div class="price">
  87. <span>&yen; 333</span>
  88. <span>beauty</span>
  89. </div>
  90. </div>
  91. <div class="intro">
  92. <a href=""><img src="../../../../static/images/shop/shop8.jpg" alt="" width="176" height="120"></a>
  93. <a href="">写真1</a>
  94. <div class="price">
  95. <span>&yen; 333</span>
  96. <span>beauty</span>
  97. </div>
  98. </div>
  99. </div>
  100. <!-- 2.右侧功能快速入口-->
  101. <div class="quick_entry">
  102. <a href=""><img src="../../../../static/images/ad/1.png" alt=""></a>
  103. <a href=""><img src="../../../../static/images/ad/2.png" alt=""></a>
  104. <a href=""><img src="../../../../static/images/ad/3.png" alt=""></a>
  105. <a href=""><img src="../../../../static/images/ad/4.png" alt=""></a>
  106. <div>
  107. <a href=""><img src="../../../../static/images/ad/image.png" alt=""></a>
  108. <a href=""><img src="../../../../static/images/ad/ad2.jpg" alt=""></a>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. </body>
  114. </html>
  1. @import "../pubilc_reset.css";
  2. @import "../public_headline/public_headline.css";
  3. .public_second_hand{
  4. width: 1200px;
  5. padding: 10px;
  6. box-sizing: border-box;
  7. margin: auto;
  8. border-radius: 5px;
  9. background-color: #fff;
  10. }
  11. .public_second_hand:hover{
  12. box-shadow: 0 0 8px #888;
  13. }
  14. /*标题1*/
  15. .public_second_hand > .title1{
  16. height: 40px;
  17. border-bottom: 1px solid #cccccc;
  18. box-sizing: border-box;
  19. }
  20. .public_second_hand > .title1 >a{
  21. font-size: 25px;
  22. margin-right: 20px;
  23. }
  24. .public_second_hand > .title1 >span{
  25. color: red;
  26. }
  27. /*标题2*/
  28. .public_second_hand > .title2 {
  29. margin-top: 20px;
  30. height: 30px;
  31. }
  32. .public_second_hand >.title2 >span{
  33. color: red;
  34. font-size: 23px;
  35. }
  36. .public_second_hand >.title2 >span ~ a{
  37. padding-left: 20px;
  38. font-size: 15px;
  39. }
  40. .public_second_hand >.title2 >span~a:hover{
  41. color: lightcoral;
  42. }
  43. /*商品展示区*/
  44. .public_second_hand >.goods{
  45. display: flex;
  46. height: 440px;
  47. /*flex-flow: row nowrap;*/
  48. }
  49. .public_second_hand >.goods>.goods_list{
  50. padding: 10px;
  51. flex-basis: 800px;
  52. display: flex;
  53. flex-flow: row wrap;
  54. justify-content: space-between;
  55. }
  56. .public_second_hand >.goods>.goods_list>.intro{
  57. width: 178px;
  58. height: 200px;
  59. display: flex;
  60. flex-flow: column nowrap;
  61. justify-content: space-between;
  62. }
  63. .public_second_hand >.goods>.goods_list>.intro img{
  64. border-bottom: 1px solid #cccccc;
  65. padding-top: 10px;
  66. border-radius:5px
  67. }
  68. .public_second_hand >.goods>.goods_list>.intro>a{
  69. font-size: 15px;
  70. font-family: "Microsoft YaHei UI";
  71. }
  72. .public_second_hand >.goods>.goods_list>.intro span:first-of-type{
  73. color: red;
  74. }
  75. .public_second_hand >.goods>.goods_list>.intro >div{
  76. display: flex;
  77. padding-top: 10px;
  78. }
  79. .public_second_hand >.goods>.goods_list>.intro span:last-of-type{
  80. color: red;
  81. background-color: #55ce9f;
  82. padding: 0 2px;
  83. margin-left: auto;
  84. }
  85. /* 功能快速入口区*/
  86. .public_second_hand >.goods>.quick_entry{
  87. flex-basis: 400px;
  88. padding: 10px;
  89. display: flex;
  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. width: 400px;
  99. display: flex;
  100. flex-direction: column;
  101. }
  102. .public_second_hand >.goods>.quick_entry>div img{
  103. width: 393px;
  104. height: 60px;
  105. }

二手交易页面


二手交易页面主要分为上面的评论输入区域和下面的已评论区域两部分,大致需要运用到的技术和二手商品页面差不多,首先先写好dom结构,再写css样式文档

代码如下

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <link rel="stylesheet" href="public_comment_reply.css">
  6. <link rel="stylesheet" href="../../../../static/font/iconfont.css">
  7. <title>public_comment_reply</title>
  8. </head>
  9. <body>
  10. <div class="public_comment_reply">
  11. <!-- 评论-->
  12. <div class="comment">
  13. <h3>我要评论</h3>
  14. <div>
  15. <label for="comment">
  16. <img src="../../../../static/images/user.png" alt="">
  17. </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="../../../../static/images/user.png" width="60" alt="">
  27. <div class="detail">
  28. <span>用户昵称</span>
  29. <span>留言内容:Php.cn</span>
  30. <div>
  31. <span>2019-12-12 15:53:45发表</span>
  32. <span><i class="iconfont icon-dianzan"></i>回复</span>
  33. </div>
  34. </div>
  35. </div>
  36. <div>
  37. <img src="../../../../static/images/user.png" width="60" alt="">
  38. <div class="detail">
  39. <span>用户昵称</span>
  40. <span>留言内容:Php.cn</span>
  41. <div>
  42. <span>2019-12-12 15:53:45发表</span>
  43. <span><i class="iconfont icon-dianzan"></i>回复</span>
  44. </div>
  45. </div>
  46. </div>
  47. <div>
  48. <img src="../../../../static/images/user.png" width="60" alt="">
  49. <div class="detail">
  50. <span>用户昵称</span>
  51. <span>留言内容:Php.cn</span>
  52. <div>
  53. <span>2019-12-12 15:53:45发表</span>
  54. <span><i class="iconfont icon-dianzan"></i>回复</span>
  55. </div>
  56. </div>
  57. </div>
  58. <div>
  59. <img src="../../../../static/images/user.png" width="60" alt="">
  60. <div class="detail">
  61. <span>用户昵称</span>
  62. <span>留言内容:Php.cn</span>
  63. <div>
  64. <span>2019-12-12 15:53:45发表</span>
  65. <span><i class="iconfont icon-dianzan"></i>回复</span>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. </body>
  72. </html>
  1. @import "../pubilc_reset.css";
  2. *{
  3. /*outline: 1px dashed red;*/
  4. }
  5. .public_comment_reply{
  6. padding: 20px;
  7. box-sizing: border-box;
  8. background-color: #fff;
  9. display: flex;
  10. flex-direction: column;
  11. }
  12. .public_comment_reply>.comment img{
  13. width: 60px;
  14. height: 60px;
  15. border-radius: 5px;
  16. box-shadow: 1px 1px 3px #cccccc;
  17. }
  18. .public_comment_reply>.comment{
  19. display: flex;
  20. flex-direction: column;
  21. }
  22. .public_comment_reply>.comment>h3{
  23. padding: 20px 0;
  24. border-top: 1px solid #cccccc;
  25. }
  26. .public_comment_reply>.comment >div{
  27. padding: 15px;
  28. height: 200px;
  29. display: flex;
  30. flex-flow: row nowrap;
  31. }
  32. .public_comment_reply>.comment >div img{
  33. align-self: center;
  34. }
  35. .public_comment_reply>.comment>div textarea{
  36. height: 200px;
  37. margin-left: 30px;
  38. flex: 1;
  39. resize: none;
  40. }
  41. .public_comment_reply>.comment>div textarea:hover{
  42. box-shadow: 0 0 8px #888888;
  43. }
  44. .public_comment_reply>.comment>button{
  45. width: 150px;
  46. height: 40px;
  47. font-size: 14px;
  48. background-color: #f64c59;
  49. border: none;
  50. color: white;
  51. align-self: end;
  52. }
  53. .public_comment_reply>.comment>button:hover{
  54. background-color: #178cee;
  55. box-shadow: 0 0 8px #888888;
  56. cursor: pointer;
  57. }
  58. .public_comment_reply>.reply{
  59. display: flex;
  60. flex-direction: column;
  61. padding: 15px;
  62. }
  63. .public_comment_reply>.reply>h3 {
  64. padding: 20px 0;
  65. }
  66. .public_comment_reply>.reply > div{
  67. display: flex;
  68. margin-top: 30px;
  69. }
  70. .public_comment_reply>.reply > div >img{
  71. align-self: center;
  72. }
  73. .public_comment_reply>.reply > div >.detail{
  74. flex: auto;
  75. display: flex;
  76. flex-direction: column;
  77. margin-left: 20px;
  78. height: 90px;
  79. justify-content: space-between;
  80. }
  81. .public_comment_reply>.reply > div >.detail > div{
  82. display: flex;
  83. justify-content: space-between;
  84. }
  85. .public_comment_reply>.reply > div >.detail > div i{
  86. color: red;
  87. font-size: 1.2rem;
  88. margin-right: 5px;
  89. }

小结:网页的设计要首先确定页面的结构,再确定结构中的元素,最后确定元素的样式,编写组件的时候要首先写出html的dom结构,再写出样式结构,页面元素的大小修改是最麻烦的一道程序,需要耐心调整。这节课学到了网页编写的思想,对接下来的编写有了一个明确的思路和一个方法步骤。

Correcting teacher:天蓬老师天蓬老师

Correction status:qualified

Teacher's comments:学到了思维方式, 这才是最大的收获
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