Correcting teacher:Guanhui
Correction status:qualified
Teacher's comments:课程的标题有点问题,需要调整!
使用grid布局技术,引用阿里图标,鼠标悬停,定位等进行仿php中文网首页入门精品课程模块,如图所示
HTML代码
<body>
<div class="container">
<h3 class="title">
<span class="iconfont icon-daima"></span>php入门精品课程<span
class="iconfont icon-daima"
></span>
</h3>
<div class="course">
<div class="item">
<img src="./images/index_learn_first.jpg" alt="" />
</div>
<div class="item">
<a href="\"
><img src="./images/5b244.png" alt="" />
<div class="des">
<div>
<span>初级</span><span>编程学习方法分享直播公益课</span>
</div>
<span>1W+次播放</span>
</div>
</a>
</div>
<div class="item">
<a href="\"
><img src="./images/5a649.jpg" alt="" />
<div class="des">
<div><span>初级</span><span>2018前端入门_HTML5</span></div>
<span>18W+次播放</span>
</div>
</a>
</div>
<div class="item">
<a href="\"
><img src="./images/5a4221.jpg" alt="" />
<div class="des">
<div><span>初级</span><span>CSS视频教程-玉女心经版</span></div>
<!-- <p>
本章节讲解的是有关CSS基础的内容,轻松明快,适合新手观看学习。
</p> -->
<span>18W+次播放</span>
</div>
</a>
</div>
<div class="item">
<a href="\"
><img src="./images/5a969.jpg" alt="" />
<div class="des">
<div>
<span>初级</span><span>JavaScript极速入门_玉女心经系列</span>
</div>
<span>10W+次播放</span>
</div>
</a>
</div>
<div class="item">
<a href="\"
><img src="./images/5d633.jpg" alt="" />
<div class="des">
<div>
<span>初级</span><span>独孤九贱(6)_jQuery视频教程</span>
</div>
<span>18W+次播放</span>
</div>
</a>
</div>
<div class="item">
<a href="\"
><img src="./images/5a707.jpeg" alt="" />
<div class="des">
<div><span>初级</span><span>30分钟学会网站布局</span></div>
<span>6w+次播放</span>
</div>
</a>
</div>
<div class="item">
<a href="\"
><img src="./images/5d106.jpg" alt="" />
<div class="des">
<div>
<span>初级</span><span>[公益直播]Web前端开发极速入门</span>
</div>
<span>5W+次播放</span>
</div>
</a>
</div>
<div class="item">
<a href="\"
><img src="./images/5a398.jpg" alt="" />
<div class="des">
<div><span>初级</span><span>phpStudy极速入门视频教程</span></div>
<span>40W+次播放</span>
</div>
</a>
</div>
<div class="item">
<a href="\"
><img src="./images/5c582.jpg" alt="" />
<div class="des">
<div>
<span>初级</span><span>ThinkPHP6.0极速入门(视频教程)</span>
</div>
<span>4W+次播放</span>
</div>
</a>
</div>
<div class="item">
<a href="\"
><img src="./images/5d885.jpg" alt="" />
<div class="des">
<div><span>中级</span><span>独孤九贱(4)_PHP视频教程</span></div>
<span>18W+次播放</span>
</div>
</a>
</div>
<div class="item">
<a href="\"
><img src="./images/5a730.jpg" alt="" />
<div class="des">
<div><span>中级</span><span>php完全自学手册</span></div>
<span>20W+次播放</span>
</div>
</a>
</div>
<div class="item">
<a href="\"
><img src="./images/5d252.jpg" alt="" />
<div class="des">
<div><span>初级</span><span>MySQL权威开发指南(教程)</span></div>
<span>2W+次播放</span>
</div>
</a>
</div>
<div class="item">
<a href="\"
><img src="./images/5d731.jpg" alt="" />
<div class="des">
<div>
<span>初级</span><span>[公益直播]PHP实战开发极速入门</span>
</div>
<span>3W+次播放</span>
</div>
</a>
</div>
</div>
</div>
</body>
CSS代码
<style>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
background-color: #f3f5f7;
}
.container {
width: 1200px;
height: 646px;
display: grid;
margin: auto;
}
a {
text-decoration: none;
}
/* 模块标题 */
.container > .title {
text-align: center;
padding: 10px 0;
}
.container > .title span {
margin: 15px;
color: rgb(65, 65, 214);
}
/* 课程 */
.container > .course {
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-template-rows: repeat(3, 1fr);
}
.container > .course > .item {
width: 217px;
height: 166px;
/* 设置边框圆角 */
border-radius: 8px;
/* 设置阴影 */
box-shadow: 0 0 10px #888;
/* 项目在单元格中垂直居中 */
place-self: start center;
}
.container > .course > .item:first-of-type {
grid-row: span 2;
height: 364px;
border-radius: 8px;
}
.container > .course > .item:first-of-type img {
width: 100%;
border-radius: 8px;
}
.container > .course > .item > a > img {
width: 100%;
border-radius: 8px;
}
.container > .course > .item > a > .des {
background-color: white;
display: flex;
flex-flow: column nowrap;
justify-content: space-between;
/* place-content: space-sbtween; */
min-height: 84px;
position: relative;
top: -40px;
border-radius: 8px;
}
.container > .course > .item > a > .des:hover {
min-height: 130px;
position: relative;
top: -85px;
}
/* .container > .course > .item > a > .des:hover p {
display: block;
background-color: rgb(219, 7, 156);
} */
.container > .course > .item > a > .des span {
font-size: 12px;
color: #555;
padding: 2px;
margin: 10px;
}
.container > .course > .item > a > .des p {
/* text-align: center; */
padding: 5px 6px 0 6px;
color: #93999f;
font-size: 12px;
height: 30px;
overflow: hidden;
line-height: 20px;
background-color: yellowgreen;
}
/* 调整‘初级’标签 */
.container > .course > .item > a > .des > div > span:first-of-type {
background-color: #939393;
color: white;
border-radius: 2px;
}
</style>