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>热门推荐</title>
<link rel="stylesheet" href="01.css">
<link rel="stylesheet" href="//at.alicdn.com/t/c/font_3964449_hddmgnomyz.css">
</head>
<body>
<div class="latest-courses">
<div class="lates"><h2>热门推荐</h2>
<a href="">更多</a>
</div>
<div class="courses-list">
<div class="course">
<a href="">
<img src="11.jpg" alt="" />
</a>
<div class="desc">
<div class="title">
<small class="tag1">初级</small>
<a href="">小白拯救者: PHP7基础语法快速预览</a>
</div>
<div class="other">
<span>88789次学习</span>
<span class="iconfont icon-shoucang">收藏</span>
</div>
</div>
</div>
<div class="course">
<a href="">
<img src="12.png" alt="" />
</a>
<div class="desc">
<div class="title">
<small class="tag1">初级</small>
<a href="">php8,我来也</a>
</div>
<div class="other">
<span>254922次学习</span>
<span class="iconfont icon-shoucang">收藏</span>
</div>
</div>
</div>
<div class="course">
<a href="">
<img src="13.jpg" alt="" />
</a>
<div class="desc">
<div class="title">
<small class="tag">中级</small>
<a href="">在线报名系统(移动端)实战【公益直播】</a>
</div>
<div class="other">
<span>69378次学习</span>
<span class="iconfont icon-shoucang">收藏</span>
</div>
</div>
</div>
<div class="course">
<a href="">
<img src="14.jpg" alt="" />
</a>
<div class="desc">
<div class="title">
<small class="tag">中级</small>
<a href="">vue 3.0全新实战课程(2021版)第一季</a>
</div>
<div class="other">
<span>54378次学习</span>
<span class="iconfont icon-shoucang">收藏</span>
</div>
</div>
</div>
<div class="course">
<a href="">
<img src="15.jpg" alt="" />
</a>
<div class="desc">
<div class="title">
<small class="tag">中级</small>
<a href="">Uniapp简爱读书项目开发--第一季</a>
</div>
<div class="other">
<span>11378次学习</span>
<span class="iconfont icon-shoucang">收藏</span>
</div>
</div>
</div>
<div class="course">
<a href="">
<img src="16.png" alt="" />
</a>
<div class="desc">
<div class="title">
<small class="tag1">初级</small>
<a href="">从PHP基础到ThinkPHP6实战(2022灭绝师妹力作)</a>
</div>
<div class="other">
<span>11378次学习</span>
<span class="iconfont icon-shoucang">收藏</span>
</div>
</div>
</div>
<div class="course">
<a href="">
<img src="17.jpg" alt="" />
</a>
<div class="desc">
<div class="title">
<small class="tag1">初级</small>
<a href="">公益直播:2023,聊聊PHP创业那点事</a>
</div>
<div class="other">
<span>22378次学习</span>
<span class="iconfont icon-shoucang">收藏</span>
</div>
</div>
</div>
<div class="course">
<a href="">
<img src="18.jpg" alt="" />
</a>
<div class="desc">
<div class="title">
<small class="tag">中级</small>
<a href="">Golang深入理解GPM模型</a>
</div>
<div class="other">
<span>378次学习</span>
<span class="iconfont icon-shoucang">收藏</span>
</div>
</div>
</div>
<div class="course">
<a href="">
<img src="19.jpg" alt="" />
</a>
<div class="desc">
<div class="title">
<small class="tag1">初级</small>
<a href="">公益直播:PHP8,究竟有啥野心..!?</a>
</div>
<div class="other">
<span>510次学习</span>
<span class="iconfont icon-shoucang">收藏</span>
</div>
</div>
</div>
<div class="course">
<a href="">
<img src="20.jpg" alt="" />
</a>
<div class="desc">
<div class="title">
<small class="tag">中级</small>
<a href="">Linux运维基础课程【全程干货详解】</a>
</div>
<div class="other">
<span>3578次学习</span>
<span class="iconfont icon-shoucang">收藏</span>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
CSS代码如下:
body {
background-color: #efefef;
}
body a {
text-decoration: none;
color: rgb(20, 20, 20);
font-size: 14px;
}
body a:hover {
color: red;
}
.latest-courses {
width: 1020px;
margin: 0 auto;
}
.latest-courses .lates {
display: flex;
place-content: space-between;
}
.latest-courses .courses-list {
display: grid;
grid-template-columns: repeat(5,1fr);
gap: 20px 10px;
}
.latest-courses .courses-list img {
width: 100%;
border-radius: 5px 5px 0 0;
}
.latest-courses .courses-list img:hover {
transform: scale(1.1);
transition: 0.3s;
}
.latest-courses .courses-list .course {
background-color: #fff;
border-radius: 5px;
overflow: hidden;
}
.latest-courses .courses-list .course .desc {
padding: 15px;
display: grid;
gap: 10px;
}
.latest-courses .courses-list .course .desc .tag {
color: red;
background-color: bisque;
border-radius: 2px;
padding: 2px 4px;
font-size: x-small;
}
.latest-courses .courses-list .course .desc .tag1 {
color: blue;
background-color: rgb(217, 228, 243);
border-radius:2px ;
padding: 2px 4px;
font-size: x-small;
}
.latest-courses .courses-list .course .desc .other {
color: #aaa;
font-size: small;
display: flex;
place-content: space-between;
}
浏览器效果图: