Author: Malte Bublitz
Language/File type: CSS (Cascading Style Sheet)
Description
Using CSS counters, we can prefix each headline with the section number.
In the CSS below, we assume the section numbers should start from 1 inside each <article>; and a section headline is inside a <h2>, and a subsection headline inside a <h3>.
Live-Preview: https://f.malte70.de/markdown_preview.php?css=markdown2.css&file=DiskPart-Befehle.md
Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
article {
counter-reset: section;
}
h2 {
counter-reset: subsection;
}
h2:before {
counter-increment: section;
content: counter(section) ". ";
font-weight: 300;
display: inline-block;
text-align: right;
width: 2em;
margin-left: -2em;
padding-right: .2em;
}
h3:before {
counter-increment: subsection;
content: counter(section) "." counter(subsection) " ";
font-weight: 300;
display: inline-block;
text-align: right;
width: 2em;
margin-left: -2em;
padding-right: .2em;
}