可以排序列表产生结果看起来像1.1,1.2,1.3(而不是只有1,2,3,...)与css? [英] Can ordered list produce result that looks like 1.1, 1.2, 1.3 (instead of just 1, 2, 3, ...) with css?

查看:138
本文介绍了可以排序列表产生结果看起来像1.1,1.2,1.3(而不是只有1,2,3,...)与css?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有序列表产生的结果看起来像1.1,1.2,1.3(而不是只有1,2,3,...)与css?到目前为止,使用 list-style-type:decimal 只生成了1,2,3,...不是1.1,1.2 ...,1.3,...

Can ordered list produce result that looks like 1.1, 1.2, 1.3 (instead of just 1, 2, 3, ...) with css? So far, using list-style-type:decimal has produced only 1, 2, 3, ... not 1.1, 1.2., 1.3, ...

感谢您的帮助

推荐答案

您可以使用计数器


嵌套的以下样式表号列表项为1,1.1,1.1.1等。

The following style sheet numbers nested list items as "1", "1.1", "1.1.1", etc.

OL { counter-reset: item }
LI { display: block }
LI:before { content: counters(item, ".") " "; counter-increment: item }


查看 嵌套计数器和范围 了解更多信息。

See Nested counters and scope for more information.

这篇关于可以排序列表产生结果看起来像1.1,1.2,1.3(而不是只有1,2,3,...)与css?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆