
![图片[1]-子比主题美化 – 网站首页排行榜样式美化-懒人Blog(资源素材网)](https://www.lanrenn.cn/wp-content/uploads/2024/05/20240502100708670.png)
HTML代码如下
将上面的HTML代码放到自己的index.php里面 我目前是放到/wp-content/themes/zibll/index.php里面搜
<?php get_sidebar(); ?><?php get_sidebar(); ?><?php get_sidebar(); ?>
显示数据修改:
首先看下面代码,(‘cat=
<?php query_posts('cat=4&showposts=5&orderby=views'); ?><?php while (have_posts()) : the_post(); ?><?php query_posts('cat=4&showposts=5&orderby=views'); ?> <?php while (have_posts()) : the_post(); ?><?php query_posts('cat=4&showposts=5&orderby=views'); ?> <?php while (have_posts()) : the_post(); ?>
将PHP代码放到index里面即可,然后我们接下来就是CSS样式啦
CSS代码—将CSS代码放到子比后台-自定义CSS样式即可!
/** 首页排行榜列表 **/@media (max-width: 768px) {.ranking-item{width:100%!important;}}.syphimg{width: 90px;height:60px;margin-right: 5px;}.syphimg img{border-radius: 8px;}.list.clearfix {display: flex;justify-content: space-between;flex-wrap: wrap;}.ranking-item {margin:0 auto;position: relative;width: calc(33.333% - 10px );/* height: 400px; *//* margin-right: 10px; *//* margin-left: 10px; */background: #fff;/* box-shadow: 0 2px 6px 0 rgb(55 55 55 / 7%); *//* border-radius: 8px; */box-shadow: 0 0 10px var(--main-shadow);border-radius: var(--main-radius);margin-bottom: 20px;}a.top-icon.js-rank-bottom1 {display: block;width: 129px;height: 43px;line-height: 32px;position: absolute;left: 150px;top: -7px;background: url(/pic/ranking1.png) no-repeat center/100%;font-size: 18px;color: #fff;font-weight: 600;text-align: center;}a.top-icon.js-rank-bottom2 {display: block;width: 129px;height: 43px;line-height: 32px;position: absolute;left: 150px;top: -7px;background: url(/pic/ranking2.png) no-repeat center/100%;font-size: 18px;color: #fff;font-weight: 600;text-align: center;}a.top-icon.js-rank-bottom3 {display: block;width: 129px;height: 43px;line-height: 32px;position: absolute;left: 150px;top: -7px;background: url(/pic/ranking3.png) no-repeat center/100%;font-size: 18px;color: #fff;font-weight: 600;text-align: center;}.class-box {margin-top: 60px;}a.class-item.js-rank {display: block;width: 100%;height: 80px;display: flex;align-items: center;margin-bottom: 20px;}.num-icon.num-icon1 {width: 40px;height: 22px;background: url(/pic/top1.png) no-repeat center/100%;margin: 0 12px 0 15px;}img.class-pic {width: 90px;border-radius: 8px;margin-right: 5px;}.class-info {width: 190px;font-size: 12px;}.name {color: #545c63;line-height: 20px;font-weight: 400;margin-bottom: 2px;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 2;overflow: hidden;-webkit-box-orient: vertical;}.price {color: #f01414;font-weight: 600;margin-bottom: 2px;}.study-num {color: #9199a1;font-weight: 400;}.num-icon.num-icon2 {background: url(/pic/top2.png) no-repeat center/100%;margin: 0 12px 0 15px;width: 40px;height: 22px;}.num-icon.num-icon3 {background: url(/pic/top3.png) no-repeat center/100%;margin: 0 12px 0 15px;width: 40px;height: 22px;}.num-icon.num-icon4 {background: url(/pic/top4.png) no-repeat center/100%;margin: 0 12px 0 15px;width: 40px;height: 22px;}.num-icon.num-icon5 {background: url(/pic/top5.png) no-repeat center/100%;margin: 0 12px 0 15px;width: 40px;height: 22px;}.num-icon.num-icon6 {background: url(/pic/top6.png) no-repeat center/100%;margin: 0 12px 0 15px;width: 19px;height: 22px;}a.bottom-link.js-rank-bottom {width: 120px;height: 24px;display: flex;justify-content: center;align-items: center;margin: 0 auto;font-size: 12px;color: #fff;line-height: 12px;font-weight: 500;background-image: linear-gradient(270deg,#ff4f39 0,#fd6400 100%);border-radius: 12px;margin-bottom: 20px;}/** 首页排行榜列表结束 **//** 首页排行榜列表 **/ @media (max-width: 768px) { .ranking-item{ width:100%!important; } } .syphimg{ width: 90px; height:60px; margin-right: 5px; } .syphimg img{ border-radius: 8px; } .list.clearfix { display: flex; justify-content: space-between; flex-wrap: wrap; } .ranking-item { margin:0 auto; position: relative; width: calc(33.333% - 10px ); /* height: 400px; */ /* margin-right: 10px; */ /* margin-left: 10px; */ background: #fff; /* box-shadow: 0 2px 6px 0 rgb(55 55 55 / 7%); */ /* border-radius: 8px; */ box-shadow: 0 0 10px var(--main-shadow); border-radius: var(--main-radius); margin-bottom: 20px; } a.top-icon.js-rank-bottom1 { display: block; width: 129px; height: 43px; line-height: 32px; position: absolute; left: 150px; top: -7px; background: url(/pic/ranking1.png) no-repeat center/100%; font-size: 18px; color: #fff; font-weight: 600; text-align: center; } a.top-icon.js-rank-bottom2 { display: block; width: 129px; height: 43px; line-height: 32px; position: absolute; left: 150px; top: -7px; background: url(/pic/ranking2.png) no-repeat center/100%; font-size: 18px; color: #fff; font-weight: 600; text-align: center; } a.top-icon.js-rank-bottom3 { display: block; width: 129px; height: 43px; line-height: 32px; position: absolute; left: 150px; top: -7px; background: url(/pic/ranking3.png) no-repeat center/100%; font-size: 18px; color: #fff; font-weight: 600; text-align: center; } .class-box { margin-top: 60px; } a.class-item.js-rank { display: block; width: 100%; height: 80px; display: flex; align-items: center; margin-bottom: 20px; } .num-icon.num-icon1 { width: 40px; height: 22px; background: url(/pic/top1.png) no-repeat center/100%; margin: 0 12px 0 15px; } img.class-pic { width: 90px; border-radius: 8px; margin-right: 5px; } .class-info { width: 190px; font-size: 12px; } .name { color: #545c63; line-height: 20px; font-weight: 400; margin-bottom: 2px; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; overflow: hidden; -webkit-box-orient: vertical; } .price { color: #f01414; font-weight: 600; margin-bottom: 2px; } .study-num { color: #9199a1; font-weight: 400; } .num-icon.num-icon2 { background: url(/pic/top2.png) no-repeat center/100%; margin: 0 12px 0 15px; width: 40px; height: 22px; } .num-icon.num-icon3 { background: url(/pic/top3.png) no-repeat center/100%; margin: 0 12px 0 15px; width: 40px; height: 22px; } .num-icon.num-icon4 { background: url(/pic/top4.png) no-repeat center/100%; margin: 0 12px 0 15px; width: 40px; height: 22px; } .num-icon.num-icon5 { background: url(/pic/top5.png) no-repeat center/100%; margin: 0 12px 0 15px; width: 40px; height: 22px; } .num-icon.num-icon6 { background: url(/pic/top6.png) no-repeat center/100%; margin: 0 12px 0 15px; width: 19px; height: 22px; } a.bottom-link.js-rank-bottom { width: 120px; height: 24px; display: flex; justify-content: center; align-items: center; margin: 0 auto; font-size: 12px; color: #fff; line-height: 12px; font-weight: 500; background-image: linear-gradient(270deg,#ff4f39 0,#fd6400 100%); border-radius: 12px; margin-bottom: 20px; } /** 首页排行榜列表结束 **//** 首页排行榜列表 **/ @media (max-width: 768px) { .ranking-item{ width:100%!important; } } .syphimg{ width: 90px; height:60px; margin-right: 5px; } .syphimg img{ border-radius: 8px; } .list.clearfix { display: flex; justify-content: space-between; flex-wrap: wrap; } .ranking-item { margin:0 auto; position: relative; width: calc(33.333% - 10px ); /* height: 400px; */ /* margin-right: 10px; */ /* margin-left: 10px; */ background: #fff; /* box-shadow: 0 2px 6px 0 rgb(55 55 55 / 7%); */ /* border-radius: 8px; */ box-shadow: 0 0 10px var(--main-shadow); border-radius: var(--main-radius); margin-bottom: 20px; } a.top-icon.js-rank-bottom1 { display: block; width: 129px; height: 43px; line-height: 32px; position: absolute; left: 150px; top: -7px; background: url(/pic/ranking1.png) no-repeat center/100%; font-size: 18px; color: #fff; font-weight: 600; text-align: center; } a.top-icon.js-rank-bottom2 { display: block; width: 129px; height: 43px; line-height: 32px; position: absolute; left: 150px; top: -7px; background: url(/pic/ranking2.png) no-repeat center/100%; font-size: 18px; color: #fff; font-weight: 600; text-align: center; } a.top-icon.js-rank-bottom3 { display: block; width: 129px; height: 43px; line-height: 32px; position: absolute; left: 150px; top: -7px; background: url(/pic/ranking3.png) no-repeat center/100%; font-size: 18px; color: #fff; font-weight: 600; text-align: center; } .class-box { margin-top: 60px; } a.class-item.js-rank { display: block; width: 100%; height: 80px; display: flex; align-items: center; margin-bottom: 20px; } .num-icon.num-icon1 { width: 40px; height: 22px; background: url(/pic/top1.png) no-repeat center/100%; margin: 0 12px 0 15px; } img.class-pic { width: 90px; border-radius: 8px; margin-right: 5px; } .class-info { width: 190px; font-size: 12px; } .name { color: #545c63; line-height: 20px; font-weight: 400; margin-bottom: 2px; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; overflow: hidden; -webkit-box-orient: vertical; } .price { color: #f01414; font-weight: 600; margin-bottom: 2px; } .study-num { color: #9199a1; font-weight: 400; } .num-icon.num-icon2 { background: url(/pic/top2.png) no-repeat center/100%; margin: 0 12px 0 15px; width: 40px; height: 22px; } .num-icon.num-icon3 { background: url(/pic/top3.png) no-repeat center/100%; margin: 0 12px 0 15px; width: 40px; height: 22px; } .num-icon.num-icon4 { background: url(/pic/top4.png) no-repeat center/100%; margin: 0 12px 0 15px; width: 40px; height: 22px; } .num-icon.num-icon5 { background: url(/pic/top5.png) no-repeat center/100%; margin: 0 12px 0 15px; width: 40px; height: 22px; } .num-icon.num-icon6 { background: url(/pic/top6.png) no-repeat center/100%; margin: 0 12px 0 15px; width: 19px; height: 22px; } a.bottom-link.js-rank-bottom { width: 120px; height: 24px; display: flex; justify-content: center; align-items: center; margin: 0 auto; font-size: 12px; color: #fff; line-height: 12px; font-weight: 500; background-image: linear-gradient(270deg,#ff4f39 0,#fd6400 100%); border-radius: 12px; margin-bottom: 20px; } /** 首页排行榜列表结束 **/
接下来就是下载图片,我将图标放在的下面,大家可以去下载!记住图片要对着CSS里面的目录对好,要不然看不到图片的!
🎉 恭喜你发现了宝藏导航!>>点此前往<<
👋 感谢您的观看,对您有用就分享出去吧 !
如您有好的资源/素材,可参与创作者激励计划享投稿分成。分成介绍 投稿成功收录,即可获得1-10 元/篇奖励。(重复内容无奖励)
本站代码模板仅供学习交流使用请勿商业运营,严禁从事违法,侵权等任何非法活动,否则后果自负!
© 版权声明
本文是原创文章,采用CC BY-NC-SA 4.0协议,完整转载请注明来自懒人资源网
THE END
文章不错?点个赞呗
- 最新
- 最热
只看作者