博客列表 >12月30日练习:php中文网show-image案例(组件图片展示案例)

12月30日练习:php中文网show-image案例(组件图片展示案例)

李东亚¹⁸⁰³⁹⁵⁴⁰¹²⁰
李东亚¹⁸⁰³⁹⁵⁴⁰¹²⁰原创
2019年12月30日 09:58:47919浏览

练习一:
1、html代码:

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <link rel="stylesheet" href="public_image_list.css">
  6. <title>图片展示区</title>
  7. </head>
  8. <body>
  9. <div class="public-headline">
  10. <span>图片展示</span>
  11. </div>
  12. <div class="public-image-list">
  13. <div class="left">
  14. <div class="title">
  15. <span><a href="">美女</a></span>
  16. <span>纵观摄影艺术</span>
  17. </div>
  18. <div class="show-image">
  19. <div>
  20. <a href="">
  21. <img src="../../../static/images/img1.jpg" alt="">
  22. <span>阴沉夏日的柔美身姿 复古少女的藕荷色心情</span>
  23. </a>
  24. </div>
  25. <div>
  26. <a href="">
  27. <img src="../../../static/images/img2.jpg" alt="">
  28. <span>愿你生活的都是每一天都是快快乐乐的, 一定要</span>
  29. </a>
  30. </div>
  31. <div>
  32. <a href="">
  33. <img src="../../../static/images/img3.jpg" alt="">
  34. <span>今夜我不关心人类,我只想你,从爱上你的那天起</span>
  35. </a>
  36. </div>
  37. <div>
  38. <a href="">
  39. <img src="../../../static/images/img4.jpg" alt="">
  40. <span>我转头,看见你走来,在阳光里,于是笑容从我心里溢出</span>
  41. </a>
  42. </div>
  43. </div>
  44. </div>
  45. <div class="center">
  46. <div class="title">
  47. <span><a href="">健康</a></span>
  48. <span>纵观健康生活</span>
  49. </div>
  50. <div class="show-image">
  51. <div>
  52. <a href="">
  53. <img src="../../../static/images/img5.jpg" alt="">
  54. <span>听闻小女治家有方,鄙人余生愿闻其详</span>
  55. </a>
  56. </div>
  57. <div>
  58. <a href="">
  59. <img src="../../../static/images/img6.jpg" alt="">
  60. <span>冰冷的啤酒,带着阳光味道的衬衫,日复一日的梦想</span>
  61. </a>
  62. </div>
  63. <div>
  64. <a href="">
  65. <img src="../../../static/images/img7.jpg" alt="">
  66. <span>你对我说的每一句话,都是沙漠里下过的雨</span>
  67. </a>
  68. </div>
  69. <div>
  70. <a href="">
  71. <img src="../../../static/images/img8.jpg" alt="">
  72. <span>你是年少的欢喜 这句话反过来也是你</span>
  73. </a>
  74. </div>
  75. </div>
  76. </div>
  77. <div class="right">
  78. <div class="title">
  79. <span><a href="">青春</a></span>
  80. <span>纵观青春色彩</span>
  81. </div>
  82. <div class="show-image">
  83. <div>
  84. <a href="">
  85. <img src="../../../static/images/img7.jpg" alt="">
  86. <span>你是我这一生等了半世未拆的礼物,世未拆的礼物</span>
  87. </a>
  88. </div>
  89. <div>
  90. <a href="">
  91. <img src="../../../static/images/img5.jpg" alt="">
  92. <span>你是我这一生等了半世未拆的礼物,世未拆的礼物</span>
  93. </a>
  94. </div>
  95. <div>
  96. <a href="">
  97. <img src="../../../static/images/img3.jpg" alt="">
  98. <span>你是我这一生等了半世未拆的礼物,世未拆的礼物</span>
  99. </a>
  100. </div>
  101. <div>
  102. <a href="">
  103. <img src="../../../static/images/img1.jpg" alt="">
  104. <span>你是我这一生等了半世未拆的礼物,世未拆的礼物</span>
  105. </a>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </body>
  111. </html>

2、css代码:

  1. @import url(../../public_reset.css);
  2. @import url(../../public/publice_headline/public_headline.css);
  3. .public-image-list {
  4. width: 1200px;
  5. margin:0 auto;
  6. display: flex;
  7. justify-content: space-between;
  8. }
  9. /*图片大小*/
  10. .public-image-list img {
  11. width: 163px;
  12. height: 123px;
  13. }
  14. /*边框效果鼠标移入*/
  15. .public-image-list > div {
  16. background-color: #fff;
  17. border-radius: 10px;
  18. padding-top:10px;
  19. padding-bottom:20px;
  20. }
  21. .public-image-list > div:hover {
  22. box-shadow: 0 0 5px #666666;
  23. }
  24. /*标题效果*/
  25. .public-image-list > div > .title > :first-child a {
  26. font-size: 24px;
  27. color: #404040;
  28. }
  29. .public-image-list > div > .title > :last-child {
  30. padding-left: 15px;
  31. font-size: 14px;
  32. color: #ff0000;
  33. }
  34. .public-image-list > div > .title {
  35. margin:10px 15px;
  36. padding-bottom: 15px;
  37. border-bottom: 1px solid #969896;
  38. }
  39. /*展示图片效果 */
  40. .public-image-list > div > .show-image {
  41. display: grid;
  42. grid-template-columns: 1fr 1fr;
  43. grid-template-rows:1fr 1fr;
  44. }
  45. .public-image-list > div > :last-child > div > a{
  46. margin:10px 15px;
  47. display: flex;
  48. flex-direction: column;
  49. }
  50. .public-image-list > div > :last-child > div > a > * {
  51. align-self: center;
  52. }
  53. .public-image-list > div > :last-child > div > a > span {
  54. width: 163px;
  55. }

3、效果图:

总结:
1、缺乏整体思路规划:例如a链接没有写,到css写好才发现,添加a标签导致大部分css选择器路径需要重新写更改。

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