我正在尝试在文件中使用 HTML 编写目录。我的目录中出现的编号有缺陷。如何修改以下内容CSS
,HTML
以便我的第四个要点Output
是4
而不是3.4
?
ol {
counter-reset: item;
}
ol li {
line-height: 30px;
}
ol ol li {
line-height: 20px;
}
li {
display: block;
}
li:before {
content: counters(item, ".")" ";
counter-increment: item;
}
<ol>
<li>
<a href="#lorem_ipsum">lorem ipsum</a>
</li>
<li>
<a href="#set">Set</a>
</li>
<li>
<a href="#title">Title</a>
</li>
<ol>
<li>
<a href="#Class">Class</a>
</li>
<li>
<a href="#Something">Something</a>
</li>
<li>
<a href="#action">Action</a>
</li>
</ol>
<li>
<a href="#table_of_references">Table of References</a>
</li>
</ol>
输出
1. Lorem Ipsum
2. Set
3. Title
3.1. Class
3.2. Something
3.3. Action
3.4. Table of References