Blogger Information
Blog 12
fans 0
comment 0
visits 3528
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
完成php中文网首页"热门推荐"课程列表组件(Grid)
len
Original
251 people have browsed it

程序实现

  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <link rel="stylesheet" href="grid.css" />
  8. <link
  9. rel="stylesheet"
  10. href="//at.alicdn.com/t/c/font_3966538_ci591vv17xi.css"
  11. />
  12. <title>热门推荐</title>
  13. </head>
  14. <style>
  15. * {
  16. margin: 0;
  17. padding: 0;
  18. box-sizing: border-box;
  19. }
  20. body {
  21. background-color: rgb(240, 242, 245);
  22. }
  23. .main {
  24. /* margin-top: 100px; */
  25. width: 1200px;
  26. /* outline: 1px solid; */
  27. padding: 5px;
  28. margin: 0 auto;
  29. }
  30. .header {
  31. margin-top: 10px;
  32. display: flex;
  33. place-content: space-between;
  34. }
  35. .header .more {
  36. background-color: rgb(236, 237, 242);
  37. border-radius: 10px;
  38. padding: 5px 15px;
  39. font-size: smaller;
  40. text-decoration: none;
  41. color: rgb(153, 153, 153);
  42. }
  43. .header .more:hover {
  44. background-color: red;
  45. color: white;
  46. }
  47. img {
  48. width: 100%;
  49. border-radius: 5px 5px 0px 0px;
  50. }
  51. .courselist {
  52. background-color: white;
  53. overflow: hidden;
  54. border-radius: 5px;
  55. }
  56. .main .row {
  57. margin-top: 10px;
  58. gap: 20px;
  59. }
  60. .main .row img:hover {
  61. transform: scale(1.1);
  62. transition: 0.3s;
  63. }
  64. .main .row .desc {
  65. padding: 10px 10px;
  66. }
  67. .main .row .desc .course {
  68. /* max-height限制最大高度,height设置容器高度 */
  69. max-height: 50px;
  70. overflow: hidden;
  71. height: 60px;
  72. }
  73. .main .row .desc .course .level {
  74. background-color: bisque;
  75. color: red;
  76. font-size: small;
  77. padding: 3px 5px;
  78. border-radius: 2px;
  79. }
  80. .main .row .desc .course .level.fresh {
  81. background-color: #e0e8fc;
  82. color: #298afd;
  83. }
  84. .main .row .desc .course .name {
  85. text-decoration: none;
  86. font-size: 16px;
  87. color: black;
  88. margin-left: 5px;
  89. }
  90. .main .row .desc .course .name:hover {
  91. color: red;
  92. }
  93. .main .row .desc .details {
  94. display: flex;
  95. place-content: space-between;
  96. margin-top: 15px;
  97. color: lightgray;
  98. font-size: small;
  99. }
  100. .main .row .desc .details .favorites {
  101. text-decoration: none;
  102. color: lightgray;
  103. }
  104. .main .row .desc .details .favorites .iconfont {
  105. font-size: small;
  106. }
  107. </style>
  108. <body>
  109. <div class="main">
  110. <div class="header">
  111. <h2 class="title">热门推荐</h2>
  112. <a href="" class="more">更多 ></a>
  113. </div>
  114. <div class="row">
  115. <div class="courselist col-2">
  116. <a href=""
  117. ><img
  118. src="https://img.php.cn/upload/course/000/000/068/6250203a9746a798.jpg"
  119. alt=""
  120. /></a>
  121. <div class="desc">
  122. <div class="course">
  123. <span class="level fresh">初级</span>
  124. <a href="" class="name">小白拯救者: PHP7基础语法快速预览</a>
  125. </div>
  126. <div class="details">
  127. <span class="num">88793次学习</span>
  128. <a href="" class="favorites"
  129. ><span class="iconfont icon-favorites">收藏</span></a
  130. >
  131. </div>
  132. </div>
  133. </div>
  134. <div class="courselist col-2">
  135. <a href=""
  136. ><img
  137. src="https://img.php.cn/upload/course/000/000/068/62b2ea11e0283309.png"
  138. alt=""
  139. /></a>
  140. <div class="desc">
  141. <div class="course">
  142. <span class="level fresh">初级</span>
  143. <a href="" class="name">php8,我来也</a>
  144. </div>
  145. <div class="details">
  146. <span class="num">254947次学习</span>
  147. <a href="" class="favorites"
  148. ><span class="iconfont icon-favorites">收藏</span></a
  149. >
  150. </div>
  151. </div>
  152. </div>
  153. <div class="courselist col-2">
  154. <a href=""
  155. ><img
  156. src="https://img.php.cn/upload/course/000/000/068/62501e37b43c6107.jpg"
  157. alt=""
  158. /></a>
  159. <div class="desc">
  160. <div class="course">
  161. <span class="level">中级</span>
  162. <a href="" class="name">在线报名系统(移动端)实战【公益直播】</a>
  163. </div>
  164. <div class="details">
  165. <span class="num">69013次学习</span>
  166. <a href="" class="favorites"
  167. ><span class="iconfont icon-favorites">收藏</span></a
  168. >
  169. </div>
  170. </div>
  171. </div>
  172. <div class="courselist col-2">
  173. <a href=""
  174. ><img
  175. src="https://img.php.cn/upload/course/000/000/068/6264eab6691cf422.jpg"
  176. alt=""
  177. /></a>
  178. <div class="desc">
  179. <div class="course">
  180. <span class="level fresh">中级</span>
  181. <a href="" class="name">vue 3.0全新实战课程(2021版)第一季</a>
  182. </div>
  183. <div class="details">
  184. <span class="num">171270次学习</span>
  185. <a href="" class="favorites"
  186. ><span class="iconfont icon-favorites">收藏</span></a
  187. >
  188. </div>
  189. </div>
  190. </div>
  191. <div class="courselist col-2">
  192. <a href=""
  193. ><img
  194. src="https://img.php.cn/upload/course/000/000/048/6101014ce7756479.jpg"
  195. alt=""
  196. /></a>
  197. <div class="desc">
  198. <div class="course">
  199. <span class="level fresh">初级</span>
  200. <a href="" class="name">Uniapp简爱读书项目开发--第一季</a>
  201. </div>
  202. <div class="details">
  203. <span class="num">112833次学习</span>
  204. <a href="" class="favorites"
  205. ><span class="iconfont icon-favorites">收藏</span></a
  206. >
  207. </div>
  208. </div>
  209. </div>
  210. </div>
  211. <div class="row" style="margin-top: 30px">
  212. <div class="courselist col-2">
  213. <a href=""
  214. ><img
  215. src="https://img.php.cn/upload/course/000/000/068/62fa13f903c00637.png"
  216. alt=""
  217. /></a>
  218. <div class="desc">
  219. <div class="course">
  220. <span class="level fresh">初级</span>
  221. <a href="" class="name"
  222. >从PHP基础到ThinkPHP6实战(2022灭绝师妹力作)</a
  223. >
  224. </div>
  225. <div class="details">
  226. <span class="num">97830次学习</span>
  227. <a href="" class="favorites">收藏</a>
  228. </div>
  229. </div>
  230. </div>
  231. <div class="courselist col-2">
  232. <a href=""
  233. ><img
  234. src="https://img.php.cn/upload/course/000/000/068/63b580b8ca752485.jpg"
  235. alt=""
  236. /></a>
  237. <div class="desc">
  238. <div class="course">
  239. <span class="level fresh">初级</span>
  240. <a href="" class="name">公益直播:2023,聊聊PHP创业那点事</a>
  241. </div>
  242. <div class="details">
  243. <span class="num">2217次学习</span>
  244. <a href="" class="favorites"
  245. ><span class="iconfont icon-favorites">收藏</span></a
  246. >
  247. </div>
  248. </div>
  249. </div>
  250. <div class="courselist col-2">
  251. <a href=""
  252. ><img
  253. src="https://img.php.cn/upload/course/000/000/068/6413e7ac3ce52126.jpg"
  254. alt=""
  255. /></a>
  256. <div class="desc">
  257. <div class="course">
  258. <span class="level">中级</span>
  259. <a href="" class="name">Golang深入理解GPM模型</a>
  260. </div>
  261. <div class="details">
  262. <span class="num">386次学习</span>
  263. <a href="" class="favorites"
  264. ><span class="iconfont icon-favorites">收藏</span></a
  265. >
  266. </div>
  267. </div>
  268. </div>
  269. <div class="courselist col-2">
  270. <a href=""
  271. ><img
  272. src="https://img.php.cn/upload/course/000/000/068/6405f30155257902.jpg"
  273. alt=""
  274. /></a>
  275. <div class="desc">
  276. <div class="course">
  277. <span class="level fresh">初级</span>
  278. <a href="" class="name">公益直播:PHP8,究竟有啥野心..!?</a>
  279. </div>
  280. <div class="details">
  281. <span class="num">511次学习</span>
  282. <a href="" class="favorites"
  283. ><span class="iconfont icon-favorites">收藏</span></a
  284. >
  285. </div>
  286. </div>
  287. </div>
  288. <div class="courselist col-2">
  289. <a href=""
  290. ><img
  291. src="https://img.php.cn/upload/course/000/000/068/63ff173c79edd672.jpg"
  292. alt=""
  293. /></a>
  294. <div class="desc">
  295. <div class="course">
  296. <span class="level">中级</span>
  297. <a href="" class="name">Linux运维基础课程【全程干货详解】</a>
  298. </div>
  299. <div class="details">
  300. <span class="num">3575次学习</span>
  301. <a href="" class="favorites"
  302. ><span class="iconfont icon-favorites">收藏</span></a
  303. >
  304. </div>
  305. </div>
  306. </div>
  307. </div>
  308. </div>
  309. </body>
  310. </html>

实现效果

grid实现热门推荐

Correcting teacher:PHPzPHPz

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