Blogger Information
Blog 62
fans 2
comment 1
visits 42290
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
13 pc网页一个模块的实战
老黑
Original
559 people have browsed it

实战-模拟PHP中文网网页的一个内容
网页原内容如下:

自己做的内容如下:

自己的代码:
html部分

  1. <body>
  2. <div class="container">
  3. <div class="items1">
  4. <img class="img" src="img/0.bmp" alt="">
  5. </div>
  6. <div class="items">
  7. <img class="img" src="img/1.bmp" alt="">
  8. <div class="ele"><a href="">
  9. <div class="ele1">
  10. <h3 class="p1" >
  11. <i class="p2">初级</i>
  12. CSS视频教程-玉女心经版
  13. </h3>
  14. <p class="p3"></p>
  15. </div>
  16. <div class="ele2">
  17. <p class="p4">10W+次播放</p>
  18. </div>
  19. </a>
  20. </div>
  21. </div>
  22. </body>

css部分

  1. * {
  2. margin: 0;
  3. padding: 0;
  4. box-sizing: border-box;
  5. font-size: 14px;
  6. }
  7. a,p {
  8. text-decoration: none;
  9. }
  10. .container {
  11. width: 1080px;
  12. height: 580px;
  13. display: grid;
  14. grid-template-columns: repeat(5, 200px);
  15. grid-template-rows: repeat(3, 165px);
  16. gap: 12px;
  17. margin: auto;
  18. }
  19. .items1 {
  20. grid-row: span 2;
  21. }
  22. .items1 > img {
  23. box-shadow: 0px 0px 10px #000;
  24. }
  25. .items {
  26. width: 200px;
  27. height: 180px;
  28. position: relative;
  29. border-radius: 5%; /*圆角情况*/
  30. }
  31. .ele > a {
  32. box-shadow: 0px 0px 10px #000;
  33. border-radius: 5%;
  34. position: absolute;
  35. top: 95px;
  36. width: 200px;
  37. height: 65px;
  38. background-color: white;
  39. }
  40. .ele > a:hover {
  41. height: 95px; /*点击后高度增加30px,对应的下面的顶部位置也向上移30px*/
  42. position: absolute;
  43. top: 65px; /*位置向上移动30px,起到一个向上扩展的效果*/
  44. display: flex;
  45. flex-direction: column;
  46. justify-content: space-between;
  47. transition-duration: 0.5s; /*整个过程延续0.5s,就有一种舒缓的感觉。至于鼠标离开后的反馈后面也可以考虑下*/
  48. }
  49. img {
  50. width: 200px;
  51. float: right;
  52. border-radius: 5%;
  53. }
  54. .p2 {
  55. background-color: grey;
  56. color: white;
  57. }
  58. h3 {
  59. font-size: 17px;
  60. }
  • ① 一个讲解:向上浮动。自己的实现。
  1. .ele > a {
  2. box-shadow: 0px 0px 10px #000;
  3. border-radius: 5%;
  4. position: absolute;
  5. top: 95px;
  6. width: 200px;
  7. height: 65px;
  8. background-color: white;
  9. }
  10. .ele > a:hover {
  11. height: 95px; /*点击后高度增加30px,对应的下面的顶部位置也向上移30px*/
  12. position: absolute;
  13. top: 65px; /*位置向上移动30px,起到一个向上扩展的效果*/
  14. display: flex;
  15. flex-direction: column;
  16. justify-content: space-between;
  17. transition-duration: 0.5s; /*整个过程延续0.5s,就有一种舒缓的感觉。至于鼠标离开后的反馈后面也可以考虑下*/
  18. }
  • 老司机的实现方式

    1. .courses-list > .container > .course .desc {
    2. display: grid;
    3. place-content: space-between;
    4. min-height: 84px;/*这个地方是关键*/
    5. background-color: #fff;
    6. border-radius: 5%;
    7. padding: 10px;
    8. position: relative;
    9. top: -42px; /*这个地方是关键*/
    10. }
    11. .courses-list > .container > .course .desc:hover {
    12. min-height: 130px;/*这个地方是关键*/
    13. cursor: pointer;
    14. position: relative;
    15. top: -90px;/*这个地方是关键*/
    16. }
  • ② 老司机内部部位的实现,
    老司机的:

    1. <div class="course">
    2. <a href=""><img src="lesson.jpg" alt="" /></a>
    3. <div class="desc">
    4. <a href=""><span>初级</span>30分钟学会网站布局</a>
    5. <span>6W+播放</span>
    6. </div>
    7. </div>

    自己的:

    1. <div class="items">
    2. <img class="img" src="img/1.bmp" alt="">
    3. <div class="ele"><a href="">
    4. <div class="ele1">
    5. <h3 class="p1" >
    6. <i class="p2">初级</i>
    7. CSS视频教程-玉女心经版
    8. </h3>
    9. <p class="p3"></p> <!--这块本来是想着放增加的内容。这个内容的添加可以通过伪类的js来实现-->
    10. </div>
    11. <div class="ele2">
    12. <p class="p4">10W+次播放</p>
    13. </div>
    14. </a>
    15. </div>
    16. </div>
Correcting teacher:GuanhuiGuanhui

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