登录  /  注册
博主信息
博文 7
粉丝 0
评论 1
访问量 2859
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
"热门推荐"课程列表组件(Grid)
PHP中文网用户-6406556
原创
343人浏览过

代码展示

html

  1. <div class="course">
  2. <div class="biaoti">
  3. <h2>热门推荐</h2>
  4. <span class="gengduo">更多</span>
  5. </div>
  6. <div class="courses-list">
  7. <!-- 课程 -->
  8. <div class="list">
  9. <!-- 课程图片 -->
  10. <a href="">
  11. <img src="111.jpg" alt="" />
  12. </a>
  13. <!-- 课程描述 -->
  14. <div class="desc">
  15. <div class="title">
  16. <small class="tag">中级</small>
  17. <a href="">Golang深入理解GPM模型</a>
  18. </div>
  19. <div class="other">
  20. <span>600次学习</span>
  21. <span><span class="iconfont icon-shoucang"></span>收藏</span>
  22. </div>
  23. </div>
  24. </div>
  25. </div>

css

  1. body {
  2. background-color: #efefef;
  3. }
  4. body a {
  5. text-decoration: none;
  6. color: #555;
  7. font-size: small;
  8. }
  9. body a:hover {
  10. color: red;
  11. }
  12. .course {
  13. width: 1020px;
  14. }
  15. /* 布局 */
  16. .biaoti {
  17. display: flex;
  18. place-content: space-between;
  19. place-items: center;
  20. }
  21. .courses-list {
  22. display: grid;
  23. grid-template-columns: repeat(5, 1fr);
  24. gap: 30px 10px;
  25. }
  26. .list img {
  27. width: 100%;
  28. border-radius: 5px 5px 0 0;
  29. position: static;
  30. z-index: 1;
  31. }
  32. /* 图片放大 */
  33. .list img:hover {
  34. transform: scale(1.1);
  35. transition: 0.3s;
  36. }
  37. .course {
  38. /* border: 1px solid #000; */
  39. }
  40. .list {
  41. background-color: white;
  42. border-radius: 5px;
  43. /* 图片溢出隐藏 */
  44. overflow: hidden;
  45. }
  46. .list .desc {
  47. padding: 15px;
  48. position: static;
  49. z-index: 2;
  50. }
  51. .list .desc .tag {
  52. font-size: x-small;
  53. color: blue;
  54. background-color: lightcyan;
  55. padding: 3px 5px;
  56. border-radius: 3px;
  57. }
  58. .list .desc a {
  59. line-height: 22px;
  60. }
  61. .list .desc .other {
  62. color: #aaa;
  63. font-size: xx-small;
  64. display: flex;
  65. place-content: space-between;
  66. margin-top: 8px;
  67. }
  68. .other .iconfont {
  69. font-size: 12px;
  70. margin-right: 3px;
  71. }
  72. .other span:last-child:hover {
  73. cursor: pointer;
  74. color: red;
  75. }

批改老师:PHPzPHPz

批改状态:合格

老师批语:总体来说不错,继续加油,还有下次提交作业的时候,要在“状态”这一栏选择“作业”进行提交
本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
1条评论
PHP中文网用户-6406556 2023-03-27 16:31:40
层级不知道该如何做
1楼
作者最新博文
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学