3 回答
TA贡献1911条经验 获得超7个赞
下面的样式表编号将列表项嵌套为“1”、“1.1”、“1.1.1”等。 OL { counter-reset: item }LI { display: block }LI:before { content: counters(item, ".") " "; counter-increment: item }
ol { counter-reset: item }
li{ display: block }
li:before { content: counters(item, ".") " "; counter-increment: item }
<ol>
<li>li element
<ol>
<li>sub li element</li>
<li>sub li element</li>
<li>sub li element</li>
</ol>
</li>
<li>li element</li>
<li>li element
<ol>
<li>sub li element</li>
<li>sub li element</li>
<li>sub li element</li>
</ol>
</li>
</ol>
TA贡献2039条经验 获得超7个赞
CSS:
ol { list-style-type: none; counter-reset: item; margin: 0; padding: 0;}ol > li { display: table; counter-increment: item; margin-bottom: 0.6em;}ol > li:before { content: counters(item, ".") ". "; display: table-cell; padding-right: 0.6em; }li ol > li { margin: 0;}li ol > li:before { content: counters(item, ".") " ";}
- 3 回答
- 0 关注
- 306 浏览
相关问题推荐
添加回答
举报