Beispiel:CSS-counters.html
Aus SELFHTML-Wiki
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" media="screen" href="./Beispiel:SELFHTML-Beispiel-Grundlayout.css">
<title>Zählung mit counters()</title>
<style>
ol {
counter-reset: table-of-content;
list-style-type: none;
}
li::before {
counter-increment: table-of-content;
content: counters(table-of-content,".", decimal) " ";
color: red;
font-weight: bold;
}
li li::before {
color: green;
}
</style>
</head>
<body>
<h1>Zählung mit counters()</h1>
<ol>
<li>Allgemeines zu Pseudoformaten</li>
<li>Pseudoformate für Verweise
<ol>
<li>:link</li>
<li>:visited</li>
<li>:hover</li>
<li>:active</li>
<li>:focus</li>
</ol>
</li>
<li>Pseudoformate für Absätze
<ol>
<li>:first-line</li>
<li>:first-letter</li>
<li>:first-child </li>
</ol>
</li>
<li>Pseudoformate für automatisch generierten Text
<ol>
<li>:before</li>
<li>:after</li>
</ol>
</li>
<li>Automatische Nummerierung</li>
</ol>
<p>Tipp: Ändern Sie den Wert <code>decimal</code> auf <code>upper-roman</code>!
</body>
</html>