我有这样一段代码,其中 HTML 是由 hieroglyph生成的,而 CSS 是由我提供的:
<html>
<head>
<style>
body {
counter-reset: chapter 3 section 0;
}
h2 {
counter-reset: slide 0;
counter-increment: section;
}
h3 {
counter-increment: slide;
}
h1:before {
content: counter(chapter) ". ";
}
h2:before {
content: counter(chapter) "." counter(section) " ";
}
h3:before {
content: counter(chapter) "." counter(section) "." counter(slide) " ";
}
</style>
</head>
<body>
<article> <h1>chapter</h1> </article>
<article> <h2>section A</h2> </article>
<article> <h3> slide a</h3> </article>
<article> <h3> slide b</h3> </article>
<article> <h2>section B</h2> </article>
<article> <h3> slide a</h3> </article>
<article> <h3> slide b</h3> </article>
</body>
</html>
我想给 h1/h2/h3 编号(我将其命名为章节、部分、幻灯片),但是
article
标签使它变得困难。
如何修复 CSS 规则,以便查看:
3. chapter
3.1 section A
3.1.1 side a
3.1.2 side b
3.2 section B
3.2.1 side a
3.2.2 side b
而不是 (h3
编号错误):
3. chapter
3.1 section A
3.1.1 side a
3.1.1 side b
3.2 section B
3.2.1 side a
3.2.1 side b