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

CSS---序号使用css设置,counter-reset、counter-increment、content配合实现备注文案的序号展示

直接上代码,全代码copy即可使用!

<template><div class="reminder"><span class="Bold_12_body" style="line-height: 8vw">温馨提示:</span><br /><div class="rule-container"><div class="Regular_12_body subtitleColor rule">提示提示提示提示提示提示123123提示提示提示提示提示提示提示提示23</div><div class="Regular_12_body subtitleColor rule">提示提示提示提示提示提示3123123提示提示提示提示提示提示提示提示23</div><div class="Regular_12_body subtitleColor rule">提示提示提示提示提示提示提12312示提示提示提示提示提示提示提示23</div></div></div>
</template><script setup></script>
<style lang="less" scoped>
.reminder {padding: 25px;
}
.rule-container {counter-reset: rule-counter; /* 重置计数器 */
}.rule {display: flex;justify-content: flex-start;
}.rule::before {counter-increment: rule-counter; /* 计数器递增 */content: counter(rule-counter) '. '; /* 设置序号内容 */margin-right: 0.5em; /* 序号与文字之间的间距 */
}.rule::after {content: attr(data-text); /* 设置文字内容 */display: block; /* 换行显示 */text-indent: 2em; /* 文字首行缩进 */
}
</style>

效果如下:其中注意如果是全数字的话,不会换行,需要自己修改使用哦!

上面属性可能存在兼容性,如果确定不会使用老版本浏览器就可以!

http://www.lryc.cn/news/441965.html

相关文章:

  • Liquor 表达式引擎基本使用
  • AI美女屠版小红书火了,被当真人推流,颜值博主慌了
  • 本地搭建我的世界服务器(JAVA)简单记录
  • 哪个快?用300万个图斑测试ArcGIS Pro的成对叠加与经典叠加
  • 超详细!百分百安装成功pytorch,建议收藏
  • web基础—dvwa靶场(四)​File Inclusion
  • 【Python】练习:控制语句(二)第1关
  • Vue3 : Pinia的性质与作用
  • 对接金蝶云星空调用即时库存信息查询API
  • pretrain Llama3
  • [附源码]SpringBoot+VUE+Java实现人脸识别系统
  • 数据库_解决SQL Server数据库log日志过大,清理日志文件方法
  • 引领长期投资新篇章:价值增长与财务安全的双重保障
  • 灾备技术演进之路 | 虚拟化无代理备份只能挂载验证和容灾吗?只能无代理恢复吗?且看科力锐升级方案
  • PowerShell install 一键部署Oracle23ai
  • 【Kubernetes】常见面试题汇总(二十五)
  • 【踩坑】装了显卡,如何让显示器从主板和显卡HDMI都输出
  • spring boot启动报错:so that it conforms to the canonical names requirements
  • unix中如何查询和修改进程的资源限制
  • 【LeetCode每日一题】——401.二进制手表
  • ROM和RAM的区别
  • tomcat的配置
  • SQL使用IN进行分组统计时如何将不存在的字段显示为0
  • MoCo对比损失
  • 01_WebRtc_一对一视频通话
  • 【小程序 - 大智慧】深入微信小程序的渲染周期
  • 《深入了解 Linux 操作系统》
  • 批评他人也需要技术
  • 安装SQL Server遇到的问题
  • java项目之编程训练系统源码(springboot)