用Grid布局完成青狐资源网首页”热门推荐”课程列表

用Grid布局完成青狐资源网首页”热门推荐”课程列表

通过3月20号晚上学习,基本熟悉grid布局的简单使用方法.用grid布局方式实现青狐资源网热门推荐课程的布局,html和css代码如下:

html代码: /*引入css*/<linkrel=“stylesheet”href=“//at.alicdn.com/t/c/font_3957845_h9ekcg68p3s.css”><linkrel=“stylesheet”href=“./css/hot-course2.css”> <divclass=“hotcourses”><h1>热门课程</h1>/*需要复制course-list div10次专业系统搭建点我wcqh.cn*/<divclass=“course-list”><divclass=“course”><ahref=“”><imgsrc=“./img/hot_img.png”alt=“”></a><divclass=“desc”><divclass=“title”>class=“tag”>初级<ahref=“”>PHP是最好的编程语言编程语言</a></div><divclass=“other”><span>35325次学习</span><spanclass=“iconfont icon-shoucang1 sc-1”>&nbsp收藏</span></div></div></专业系统搭建点我wcqh.cndiv></div></div>

CSS代码如下:

body{ padding:0px; margin:0px; boxsizing: borderbox; backgroundcolor:#e6e6e6;}body a{ textdecoration: none; color:#555; fontsize:;}body a:hover{ color:red}.hotcourses{ width:1000px;/* border: 1px solid #000; */ margin:0auto;}.courselist{ display: grid; gridtemplatecolumns:repea专业系统搭建点我wcqh.cnt(5,1fr); gap:20px10px;}.courselist .course{ backgroundcolor:#fff; borderradius:5px; overflow: hidden;}.courselist .course .desc{ padding:10px; display: grid; gap:10px;}.courselist .course img{ width:100%; borderradius:5px5px00;}.courselist .course img:hover{/* 鼠标放上去图片变大 */ transform: scale(1.1);/* 图片变化速度0.3秒 专业系统搭建点我wcqh.cn*/ transition:0.3s;}.course .title .tag{ backgroundcolor:lightsalmon; padding:3px; color:#fff; fontsize: x;}.courselist .course .desc .other{ display: flex; placecontent: spacebetween; color:#aaa; fontsize:;}.courselist .course .desc .other .sc1{ fontsize:;}.courselist .course .desc .other .sc1:hov专业系统搭建点我wcqh.cner{ color: red; cursor: pointer;}

执行效果如下:

批改老师:PHPz 批改状态:合格 老师批语:完成的很好,效果实现的不错,最新课程的后面还有一个“更多”
作者最新博文
2023-03-02 18:03:17

© 版权声明
THE END
喜欢就支持一下吧
点赞651 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容