仿php中文网热门推荐列表
- 效果图
- html代码
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link
rel="stylesheet"
href="//at.alicdn.com/t/c/font_3972950_hp3q6sxc5fb.css"
/>
<link rel="stylesheet" href="demo.css" />
</head>
<body>
<div class="course">
<span class="title">热门推荐</span>
<div class="course-list">
<div class="course-list-item">
<img
src="https://img.php.cn/upload/course/000/000/068/6250203a9746a798.jpg"
alt=""
/>
<dl>
<dt>
<i class="chuji">初级</i>
<a href="#" ,title="小白拯救者: PHP7基础语法快速预览"
>小白拯救者: PHP7基础语法快速预览</a
>
</dt>
<dd>
<p>88876次学习</p>
<span><i class="iconfont icon-shoucang"></i>收藏</span>
</dd>
</dl>
</div>
<div class="course-list-item">
<img
src="https://img.php.cn/upload/course/000/000/068/62b2ea11e0283309.png"
alt=""
/>
<dl>
<dt>
<i class="chuji">初级</i>
<a href="" title="php8,我来也">php8,我来也</a>
</dt>
<dd>
<p>88876次学习</p>
<span><i class="iconfont icon-shoucang"></i>收藏</span>
</dd>
</dl>
</div>
<div class="course-list-item">
<img
src="https://img.php.cn/upload/course/000/000/068/62501e37b43c6107.jpg"
alt=""
/>
<dl>
<dt>
<i class="zhongji">中级</i>
<a href="" title="在线报名系统(移动端)实战【公益直播】"
>在线报名系统(移动端)实战【公益直播】</a
>
</dt>
<dd>
<p>88876次学习</p>
<span><i class="iconfont icon-shoucang"></i>收藏</span>
</dd>
</dl>
</div>
<div class="course-list-item">
<img
src="https://img.php.cn/upload/course/000/000/068/6264eab6691cf422.jpg"
alt=""
/>
<dl>
<dt>
<i class="zhongji">中级</i>
<a href="" title="vue 3.0全新实战课程(2021版)第一季"
>vue 3.0全新实战课程(2021版)第一季</a
>
</dt>
<dd>
<p>88876次学习</p>
<span><i class="iconfont icon-shoucang"></i>收藏</span>
</dd>
</dl>
</div>
<div class="course-list-item">
<img
src="https://img.php.cn/upload/course/000/000/048/6101014ce7756479.jpg"
alt=""
/>
<dl>
<dt>
<i class="zhongji">中级</i>
<a href="" title="Uniapp简爱读书项目开发--第一季"
>Uniapp简爱读书项目开发--第一季</a
>
</dt>
<dd>
<p>88876次学习</p>
<span><i class="iconfont icon-shoucang"></i>收藏</span>
</dd>
</dl>
</div>
<div class="course-list-item">
<img
src="https://img.php.cn/upload/course/000/000/068/62fa13f903c00637.png"
alt=""
/>
<dl>
<dt>
<i class="chuji">初级</i>
<a href="" title="从PHP基础到ThinkPHP6实战(2022灭绝师妹力作)"
>从PHP基础到ThinkPHP6实战(2022灭绝师妹力作)</a
>
</dt>
<dd>
<p>88876次学习</p>
<span><i class="iconfont icon-shoucang"></i>收藏</span>
</dd>
</dl>
</div>
<div class="course-list-item">
<img
src="https://img.php.cn/upload/course/000/000/068/63b580b8ca752485.jpg"
alt=""
/>
<dl>
<dt>
<i class="chuji">初级</i>
<a href="" title="公益直播:2023,聊聊PHP创业那点事"
>公益直播:2023,聊聊PHP创业那点事</a
>
</dt>
<dd>
<p>88876次学习</p>
<span><i class="iconfont icon-shoucang"></i>收藏</span>
</dd>
</dl>
</div>
<div class="course-list-item">
<img
src="https://img.php.cn/upload/course/000/000/068/641962a8cd46e548.png"
alt=""
/>
<dl>
<dt>
<i class="chuji">初级</i>
<a href="" title="Go语言课程Gin框架实战">Go语言课程Gin框架实战</a>
</dt>
<dd>
<p>88876次学习</p>
<span><i class="iconfont icon-shoucang"></i>收藏</span>
</dd>
</dl>
</div>
<div class="course-list-item">
<img
src="https://img.php.cn/upload/course/000/000/068/6413e7ac3ce52126.jpg"
alt=""
/>
<dl>
<dt>
<i class="zhongji">中级</i>
<a href="" title="Golang深入理解GPM模型">Golang深入理解GPM模型</a>
</dt>
<dd>
<p>88876次学习</p>
<span><i class="iconfont icon-shoucang"></i>收藏</span>
</dd>
</dl>
</div>
<div class="course-list-item">
<img
src="https://img.php.cn/upload/course/000/000/068/6405f30155257902.jpg"
alt=""
/>
<dl>
<dt>
<i class="chuji">初级</i>
<a href="" title="公益直播:PHP8,究竟有啥野心..!?"
>公益直播:PHP8,究竟有啥野心..!?</a
>
</dt>
<dd>
<p>88876次学习</p>
<span><i class="iconfont icon-shoucang"></i>收藏</span>
</dd>
</dl>
</div>
</div>
</div>
</body>
</html>
- CSS实现
a {
text-decoration: none;
}
body {
background-color: #f3f5f7;
}
.course {
max-width: 1200px;
margin: 0 auto;
padding: 0 15px;
}
.course > .title {
display: block;
font-weight: bolder;
font-size: 22px;
margin-top: 20px;
}
.course > .course-list {
display: grid;
grid-template-columns: repeat(5, 1fr);
margin-top: 20px;
gap: 20px;
}
.course-list-item {
width: 224px;
height: 235px;
background-color: white;
border-radius: 6px;
}
.course-list-item > img {
width: 224px;
height: 130px;
border-radius: 6px 6px 0 0;
}
.course-list-item > dl {
padding: 0 18px;
position: relative;
}
.course-list-item > dl > dt {
margin-top: 18px;
overflow: hidden;
height: 45px;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
display: -moz-box;
-moz-line-clamp: 2;
-moz-box-orient: vertical;
word-wrap: break-word;
word-break: break-all;
white-space: normal;
}
.course-list-item > dl > dd {
margin-top: 15px;
display: grid;
grid-template-columns: repeat(2, 1fr);
place-content: center space-between;
font-size: 12px;
color: #b7b7b7;
}
.course-list-item > dl > dt > .chuji,
.course-list-item > dl > dt > .zhongji {
display: inline-block;
font-size: 12px;
width: 28px;
height: 16px;
line-height: 16px;
text-align: center;
font-style: normal;
border-radius: 2px;
padding: 2px 4px;
margin-right: 5px;
}
.course-list-item > dl > dt > .chuji {
color: #298afd;
background-color: #e0e8fc;
}
.course-list-item > dl > dt > .zhongji {
color: #fd4029;
background-color: #fce7e0;
}
.course-list-item > dl > dt > a {
color: #333;
}