我希望模仿我在立法法规中看到的有序列表格式。一个特点是你有时会看到这样的列表:
(a) yadda
(b) yadda
(b-1) yadda
(b-2) yadda
(c) yadda
(d) yadda
答案 0 :(得分:1)
您可以使用伪元素::before
和CSS counters
ul {
counter-reset: list, list2, list3;
}
li {
list-style: none;
counter-increment: list;
}
li::before {
content: "(" counter(list, lower-alpha)")";
position: relative;
left: -5px
}
li:nth-child(3) {
counter-increment: list2 2
}
li:nth-last-child(2) {
counter-increment: list3 3
}
li:nth-child(3)::before {
content: "(" counter(list2, lower-alpha)"-1)";
}
li:nth-child(4)::before {
content: "(" counter(list2, lower-alpha)"-2)";
}

<ul>
<li>Some text here</li>
<li>Some more text here..</li>
<li>Oh yeah, here's some pretty text</li>
<li>Some text here</li>
<li>Some more text here..</li>
<li>Oh yeah, here's some pretty text</li>
</ul>
&#13;
答案 1 :(得分:0)
要在HTML中创建有序列表,您必须使用标记<ol>
来指定有序列表,并且每个项目都应该是<li>
“列表项”。
<ol>
<li>yadda</li>
<li>yadda</li>
<li>
<ol>
<li>yadda</li>
<li>yadda</li>
</ol>
</li>
<li>yadda</li>
</ol>
请在此处查看示例:
https://jsfiddle.net/jruizx/pcs2mh4j/
你可以看一下这个问题: