列举几个简单的文章排行榜数字效果

<style>
li{width:300px; border-bottom: 1px dotted #ccc; line-height: 30px; height: 30px; overflow:hidden }
li{list-style: decimal inside; }
</style>
<ul>
<li>文章1</li>
<li>文章2</li>
</ul>使用这种方法,需要在父级标签设置counter-reset:section;
<style>
ul{counter-reset:section;}
li{width:300px; border-bottom: 1px dotted #ccc; line-height: 30px; height: 30px; overflow:hidden }
li:before{counter-increment:section;content:counter(section);display:inline-block;padding:0 6px;margin-right:10px;height:18px;line-height:18px;background:#717070;color:#fff;border-radius:3px;font-size:9px}
li:nth-child(1):before{background:#ff6a00}
li:nth-child(2):before{background:#107db4}
li:nth-child(3):before{background:#56ae11}
</style>
<ul>
<li>文章1</li>
<li>文章2</li>
<li>文章3</li>
<li>文章4</li>
</ul><style>
ul{counter-reset:section;}
li{width:300px; border-bottom: 1px dotted #ccc; line-height: 30px; height: 30px; overflow:hidden }
li i{display:inline-block;font-style:initial;padding:0 6px;margin-right:10px;height:18px;line-height:18px;background:#717070;color:#fff;border-radius:3px;font-size:9px}
.red1{background:#ff6a00}
.red2{background:#107db4}
.red3{background:#56ae11}
</style>
<ul>
<li>文章1</li>
<li>文章2</li>
<li>文章3</li>
<li>文章4</li>
</ul>
<script>
listsort()
//显示排行
function listsort() {
var index = 0;
$("li").each(function () {
index++;
var num = $("<i>" + index + "</i>");
if (index <= 3)
num.addClass("red" +index);
$(this).prepend(num);
});
}
</script>比较三种方法,无论是从代码量、还是特效,推荐第二种方法,而且便以维护
一套面向小企业用户的企业网站程序!功能简单,操作简单。实现了小企业网站的很多实用的功能,如文章新闻模块、图片展示、产品列表以及小型的下载功能,还同时增加了邮件订阅等相应模块。公告,友情链接等这些通用功能本程序也同样都集成了!同时本程序引入了模块功能,只要在系统默认模板上创建模块,可以在任何一个语言环境(或任意风格)的适当位置进行使用!
0
地址:http://cssteach.com/html/show-12-88.html
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号