Beispiel:CSS-counter.html
Aus SELFHTML-Wiki
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./Beispiel:SELFHTML-Beispiel-Grundlayout.css">
<title>Zählen mit CSS counter()</title>
<style>
body {
counter-reset: count1 0 count2 0;
h2 {
counter-increment: count1 1;
counter-set: count2 0;
}
h2::before {
content: counter(count1) ' ';
}
h3 {
counter-increment: count2 1;
}
h3::before {
content: counter(count1) '.' counter(count2,lower-alpha) ' ';
}
</style>
</head>
<body>
<h1>Überschriftennummerierung mit CSS Countern</h1>
<h2>Hauptüberschrift</h2>
<p>Lorem Ipsum</p>
<h3>Unterüberschrift</h3>
<p>Lorem Ipsum</p>
<h3>Unterüberschrift</h3>
<p>Lorem Ipsum</p>
<h2>Hauptüberschrift</h2>
<p>Lorem Ipsum</p>
<h3>Unterüberschrift</h3>
<p>Lorem Ipsum</p>
</body>
</html>