当前位置: 首页 > news >正文

前端ul好看的li列表样式

文章目录

    • 效果
    • html文件
    • vue文件

效果

以下是实际效果截图:

在这里插入图片描述

html文件

<!DOCTYPE html>
<html><head><style>.other-item-title {margin: 10px 20px;padding: 5px;line-height: 30px;font-weight: 400;border-bottom: 1px solid #e8e9e7;color: #383937;position: relative;font-size: 18px}.other-item .inner {margin: 0 20px;padding-bottom: 10px}.inner .hot-list-article li {display: block;line-height: 32px;position: relative;margin: 3px 0;counter-increment: nums;padding-left: 30px;overflow: hidden;word-wrap: normal !important;white-space: nowrap;text-overflow: ellipsis}.hot-list-article li a {color: #787977}.hot-list-article li:before {color: #000;width: 22px;height: 22px;line-height: 22px;text-align: center;content: counter(nums, decimal);position: absolute;left: 0;top: 5px;border-radius: 100%;background-color: #edefee;text-shadow: 0 1px 0 rgba(255, 255, 255, .5);font-family: SourceCodeProRegular, Menlo, Monaco, Consolas, "Courier New", monospace, 'Helvetica Neue', Arial, sans-serif}/*以上就是一个稍微好看的有编号的li列表 *//*加上以下之后,排名前三的数据编号就添加了编号颜色,更好看*/.hot-list-article li:first-child:before,.hot-list-article li:nth-child(2):before,.hot-list-article li:nth-child(3):before {color: #fff;text-shadow: none}.hot-list-article li:first-child:before {background-color: #e24d46}/*第1行的行号样式*/.hot-list-article li:nth-child(2):before {background-color: #2ea7e0}/*第2行的行号样式*/.hot-list-article li:nth-child(3):before {background-color: #6bc30d}/*第3行的行号样式*/.hot-list-article li a:hover {text-decoration: underline;color: #6bc30d}/*鼠标移过更好看*/</style>
</head><body><div class="other-item"><h5 class="other-item-title">热门文章</h5><div class="inner"><ul class="hot-list-article"><li> <a href="/Blog/Read/9">SpringBoot 入门爬虫项目实战</a></li><li> <a href="/Blog/Read/12">SpringBoot 2.x 教你快速入门</a></li><li> <a href="/Blog/Read/13">java学习路线</a></li><li> <a href="/Blog/Read/4">基于SpringBoot+JWT+Redis跨域单点登录的实现</a></li><li> <a href="/Blog/Read/7">SpringBoot 中如何使用SwaggerAPI接口文档?</a></li><li> <a href="/Blog/Read/11">小白轻松入门Redis</a></li><li> <a href="/Blog/Read/14">微信一键登录功能的实现</a></li><li> <a href="/Blog/Read/8">NPOI导入导出Excel</a></li></ul></div></div>
</body></html>

vue文件

vue2 中实现

<template><div class="other-item"><h5 class="other-item-title">热门文章</h5><div class="inner"><ul class="hot-list-article"><li v-for="(item, i) in data" :key="i">{{ item.title }}</li></ul></div></div>
</template>
<script>
export default {data() {return {data: [{ title: "SpringBoot 入门爬虫项目实战" },{ title: "java学习路线" },{ title: "基于SpringBoot+JWT+Redis跨域单点登录的实现" },{ title: "SpringBoot 中如何使用SwaggerAPI接口文档?" },{ title: "小白轻松入门Redis" },{ title: "微信一键登录功能的实现" },{ title: "NPOI导入导出Excel" },],};},created() {},methods: {},
};
</script>
<style lang="scss" scoped>
ul {li {text-align: left;font-size: 16px;cursor: pointer;&:hover {color: #2ea7e0;}}
}.other-item-title {margin: 10px 20px;padding: 5px;line-height: 30px;font-weight: 400;border-bottom: 1px solid #e8e9e7;color: #383937;position: relative;font-size: 18px;
}.other-item .inner {margin: 0 20px;padding-bottom: 10px;
}.inner .hot-list-article li {display: block;line-height: 32px;position: relative;margin: 3px 0;counter-increment: nums;padding-left: 30px;overflow: hidden;word-wrap: normal !important;white-space: nowrap;text-overflow: ellipsis;
}.hot-list-article li a {color: #787977;
}.hot-list-article li:before {color: #000;width: 22px;height: 22px;line-height: 22px;text-align: center;content: counter(nums, decimal);position: absolute;left: 0;top: 5px;border-radius: 100%;background-color: #edefee;text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);font-family: SourceCodeProRegular, Menlo, Monaco, Consolas, "Courier New",monospace, "Helvetica Neue", Arial, sans-serif;
}/*以上就是一个稍微好看的有编号的li列表 */
/*加上以下之后,排名前三的数据编号就添加了编号颜色,更好看*/
.hot-list-article li:first-child:before,
.hot-list-article li:nth-child(2):before,
.hot-list-article li:nth-child(3):before {color: #fff;text-shadow: none;
}.hot-list-article li:first-child:before {background-color: #e24d46;
}/*第1行的行号样式*/
.hot-list-article li:nth-child(2):before {background-color: #2ea7e0;
}/*第2行的行号样式*/
.hot-list-article li:nth-child(3):before {background-color: #6bc30d;
}/*第3行的行号样式*/
.hot-list-article li a:hover {text-decoration: underline;color: #6bc30d;
}/*鼠标移过更好看*/
</style>

参考文章:ul好看的li列表样式

下班~

相关文章:

  • 长安链共识算法切换:动态调整,灵活可变
  • 项目实践《小说网站数据爬取》
  • 容器特权和接口爆破
  • Java 在PDF中插入页眉、页脚
  • .NET 依赖注入和配置系统
  • WebGL 理论基础 01 WebGL 基础概念
  • Linux常用命令(二)
  • Qt 容器类控件
  • 在Linux/Ubuntu/Debian中创建自己的命令快捷方式
  • Vue3快速上手(十七)Vue3之状态管理Pinia
  • 基于sortablejs实现拖拽element-ui el-table表格行进行排序
  • java Flink(四十二)Flink的序列化以及TypeInformation介绍(源码分析)
  • 探索ChatGPT时代下的下一代信息检索系统:机遇与挑战
  • 系统资源耗尽对服务器的影响
  • Linux 系统日志
  • .pyc 想到的一些问题
  • [译]前端离线指南(上)
  • 【407天】跃迁之路——程序员高效学习方法论探索系列(实验阶段164-2018.03.19)...
  • Django 博客开发教程 16 - 统计文章阅读量
  • JAVA_NIO系列——Channel和Buffer详解
  • JavaScript 基础知识 - 入门篇(一)
  • Mysql数据库的条件查询语句
  • Python代码面试必读 - Data Structures and Algorithms in Python
  • Vue 2.3、2.4 知识点小结
  • VuePress 静态网站生成
  • 记一次删除Git记录中的大文件的过程
  • 前端js -- this指向总结。
  • 前端技术周刊 2019-02-11 Serverless
  • 如何正确配置 Ubuntu 14.04 服务器?
  • 微信公众号开发小记——5.python微信红包
  • 云大使推广中的常见热门问题
  • 在GitHub多个账号上使用不同的SSH的配置方法
  • 智能合约开发环境搭建及Hello World合约
  • ionic入门之数据绑定显示-1
  • linux 淘宝开源监控工具tsar
  • 交换综合实验一
  • ​TypeScript都不会用,也敢说会前端?
  • ​七周四次课(5月9日)iptables filter表案例、iptables nat表应用
  • ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLTr
  • #1014 : Trie树
  • #pragma data_seg 共享数据区(转)
  • $$$$GB2312-80区位编码表$$$$
  • ${ }的特别功能
  • (delphi11最新学习资料) Object Pascal 学习笔记---第5章第5节(delphi中的指针)
  • (附源码)php新闻发布平台 毕业设计 141646
  • (附源码)spring boot车辆管理系统 毕业设计 031034
  • (机器学习-深度学习快速入门)第一章第一节:Python环境和数据分析
  • .NET C#版本和.NET版本以及VS版本的对应关系
  • .NET NPOI导出Excel详解
  • .NET/C# 的字符串暂存池
  • .net安装_还在用第三方安装.NET?Win10自带.NET3.5安装
  • /dev/VolGroup00/LogVol00:unexpected inconsistency;run fsck manually
  • /使用匿名内部类来复写Handler当中的handlerMessage()方法
  • @private @protected @public
  • @在php中起什么作用?