博客列表 >flex组件实战--PHP培训第十期

flex组件实战--PHP培训第十期

孔小帅
孔小帅原创
2019年12月26日 23:56:18617浏览

组件实战1—二手交易组件

代码如下:

  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-headline">
  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. <!--left-商品列表-->
  32. <div class="left-goods-list">
  33. <!--商品介绍-->
  34. <div class="intro">
  35. <a href=""><img src="../../../static/images/shop/shop1.jpg" alt="" ></a>
  36. <a href=""> 美女性感写真海报墙艺术装饰画贴画图1</a>
  37. <div>
  38. <span>&yen;333</span>
  39. <span>美女</span>
  40. </div>
  41. </div>
  42. <div class="intro">
  43. <a href=""><img src="../../../static/images/shop/shop1.jpg" alt=""></a>
  44. <a href=""> 美女性感写真海报墙艺术装饰画贴画图1</a>
  45. <div>
  46. <span>&yen;333</span>
  47. <span>美女</span>
  48. </div>
  49. </div>
  50. <div class="intro">
  51. <a href=""><img src="../../../static/images/shop/shop1.jpg" alt=""></a>
  52. <a href=""> 美女性感写真海报墙艺术装饰画贴画图1</a>
  53. <div>
  54. <span>&yen;333</span>
  55. <span>美女</span>
  56. </div>
  57. </div>
  58. <div class="intro">
  59. <a href=""><img src="../../../static/images/shop/shop1.jpg" alt=""></a>
  60. <a href=""> 美女性感写真海报墙艺术装饰画贴画图1</a>
  61. <div>
  62. <span>&yen;333</span>
  63. <span>美女</span>
  64. </div>
  65. </div>
  66. <div class="intro">
  67. <a href=""><img src="../../../static/images/shop/shop1.jpg" alt=""></a>
  68. <a href=""> 美女性感写真海报墙艺术装饰画贴画图1</a>
  69. <div>
  70. <span>&yen;333</span>
  71. <span>美女</span>
  72. </div>
  73. </div>
  74. <div class="intro">
  75. <a href=""><img src="../../../static/images/shop/shop1.jpg" alt=""></a>
  76. <a href=""> 美女性感写真海报墙艺术装饰画贴画图1</a>
  77. <div>
  78. <span>&yen;333</span>
  79. <span>美女</span>
  80. </div>
  81. </div>
  82. <div class="intro">
  83. <a href=""><img src="../../../static/images/shop/shop1.jpg" alt=""></a>
  84. <a href=""> 美女性感写真海报墙艺术装饰画贴画图1</a>
  85. <div>
  86. <span>&yen;333</span>
  87. <span>美女</span>
  88. </div>
  89. </div>
  90. <div class="intro">
  91. <a href=""><img src="../../../static/images/shop/shop1.jpg" alt=""></a>
  92. <a href=""> 美女性感写真海报墙艺术装饰画贴画图1</a>
  93. <div>
  94. <span>&yen;333</span>
  95. <span>美女</span>
  96. </div>
  97. </div>
  98. </div>
  99. <!--right-快速功能入口-->
  100. <div class="right-quick-entry">
  101. <a href=""><img src="../../../static/images/ad/1.png" alt="">1</a>
  102. <a href=""><img src="../../../static/images/ad/2.png" alt="">2</a>
  103. <a href=""><img src="../../../static/images/ad/3.png"alt="">3</a>
  104. <a href=""><img src="../../../static/images/ad/4.png" alt="">4</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>

样式代码如下:

  1. /*引入公共样式库*/
  2. @import "../../public_reset.css";
  3. @import url("../public_headline/public_headline.css");
  4. .public_second_hand{
  5. width: 1200px;
  6. padding: 10px;
  7. box-sizing:border-box;
  8. margin:auto;
  9. border-radius:15px;
  10. background-color: #fff;
  11. }
  12. .public_second_hand:hover{
  13. box-shadow:0 0 8px #333333;
  14. }
  15. /*title1*/
  16. .public_second_hand>.title1{
  17. height: 50px;
  18. border-bottom:2px solid #cccccc;
  19. }
  20. .public_second_hand>.title1>a{
  21. font-size:23px;
  22. /*color: red;*/
  23. }
  24. .public_second_hand>.title1>span{
  25. color: red;
  26. margin-left: 6px;
  27. }
  28. .public_second_hand>.title2{
  29. height: 50px;
  30. }
  31. .public_second_hand>.title2>span{
  32. font-size:23px;
  33. color: red;
  34. }
  35. .public_second_hand>.title2>a{
  36. padding:20px;
  37. }
  38. .public_second_hand>.title2>a:hover{
  39. color: #DD4A68;
  40. cursor: pointer;
  41. }
  42. .public_second_hand>.goods{
  43. height: 440px;
  44. display:flex;
  45. }
  46. /*.public_second_hand>.goods>.left-goods-list{*/
  47. /*padding: 10px;*/
  48. /*flex-basis: 800px;*/
  49. /*display: flex;*/
  50. /*flex-flow: row nowrap;*/
  51. /*justify-content: space-between;*/
  52. /*}*/
  53. /*.public_second_hand>.goods>.left-goods-list>.intro>a>img{*/
  54. /*width: 176px;*/
  55. /*height: 120px;*/
  56. /*}*/
  57. .public_second_hand>.goods>.left-goods-list>.intro img{
  58. width: 176px;
  59. height: 120px;
  60. border: 1px solid #cccccc;
  61. border-radius:5px;
  62. }
  63. .public_second_hand>.goods>.left-goods-list{
  64. /*width: 800px;*/
  65. padding:10px;
  66. flex-basis: 800px;
  67. display: flex;
  68. /*flex布局,水平方向,wrap换行,nowrap不换行*/
  69. flex-flow: row wrap;
  70. justify-content: space-between;
  71. }
  72. .public_second_hand>.goods>.left-goods-list>.intro{
  73. width: 178px;
  74. height: 200px;
  75. display: flex;
  76. flex-flow: column nowrap;
  77. justify-content: space-between;
  78. }
  79. .public_second_hand>.goods>.left-goods-list>.intro span:first-of-type{
  80. color:red;
  81. }
  82. .public_second_hand>.goods>.left-goods-list>.intro>div{
  83. display: flex;
  84. }
  85. .public_second_hand>.goods>.left-goods-list>.intro span:last-of-type{
  86. margin-left: auto;
  87. background-color: #669900;
  88. color: white;
  89. }
  90. .public_second_hand>.goods>.right-quick-entry{
  91. flex-basis: 400px;
  92. display: flex;
  93. flex-flow: row wrap;
  94. justify-content: space-between;
  95. }
  96. .public_second_hand>.goods>.right-quick-entry div{
  97. /*width: 300px;*/
  98. display: flex;
  99. flex-flow: column;
  100. justify-content: space-between;
  101. }
  102. /*.public_second_hand>.goods>.right-quick-entry img{*/
  103. /*width: 160px;*/
  104. /*height: 130px;*/
  105. /*}*/

运行结果

二手交易组件

思路及实现过程

1、关于css的应用还是有些薄弱,看老师进行演示的时候还能弄明白,自己实际操作的时候就不知道怎么进行分析了,只能参考老师的代码一步一步分析,回想当时怎么分析的,为什么要使用这样设置;
2、在模仿的过程中找到思路,同时也加强了各个元素控件的认识和应用。

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