我有一个 html 中的三级有序列表,我想为其提供如下样式:
1. Item 1
1.1 Item 2
1.1.1 Item 3
下一个 plunker 中有一个 html 示例:
http://plnkr.co/edit/DqhZ5pJILTUHGSNaA1vm?p=preview http://plnkr.co/edit/DqhZ5pJILTUHGSNaA1vm?p=preview
我用css做了一个网上推荐的样式,比如
ol { counter-reset: item }
li:before { content: counters(item, "."); counter-increment: item }
但它似乎不起作用。
请任何相关评论都会有很大帮助。
使用以下代码:
html:
<ol>
<li> Should be Item 1
<ol>
<li> Should be Item 1.1</li>
<li> Should be Item 1.2</li>
<li> Should be Item 1.3
<ol>
<li> Should be Item 1.3.1
</ol>
<li>Should be Item 1.4</li>
</ol>
</li>
<li> Should be Item 2</li>
</ol>
css:
ol { counter-reset: item }
ol li { display: block }
ol li:before { content: counters(item, ".") ". "; counter-increment: item }
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)