CSS カウンターを使用して見出しにセクション番号を追加する通常の方法を使用すると、header
タグの使用時に問題が発生します。
counter
どういうわけか(s)に干渉しているようです
body {
counter-reset: h1
}
h1 {
counter-reset: h2
}
h2 {
counter-reset: h3
}
h1:before {
counter-increment: h1;
content: counter(h1)". "
}
h2:before {
counter-increment: h2;
content: counter(h1)"." counter(h2)". "
}
h3:before {
counter-increment: h3;
content: counter(h1)"."counter(h2)"." counter(h3)". "
}
<!DOCTYPE HTML>
<html>
<head>
<title>Headings counting</title>
</head>
<body>
<header>
<h1>First chapter</h1>
</header>
<h2>Sub Chapter</h2>
<h2>Sub Chapter</h2>
<h2>Sub Chapter</h2>
<h3>Sub sub section</h3>
</body>
</html>
出力は次のとおりです。
- 最初の章
- 1.1。サブチャプター
- 1.1。サブチャプター
- 1.1。サブチャプター
- 1.0.1。サブサブセクション
header
タグを削除した後output is as expected
:
- 最初の章
- 1.1。サブチャプター
- 1.2. サブチャプター
- 1.3。サブチャプター
- 1.3.1. サブサブセクション
header
H1 付近のタグを使用すると、この結果になるかどうか。Chrome と Opera ではなく、Firefox と Edge でそうします