Last active
January 12, 2018 12:12
-
-
Save steffiland/4022805e150720ac2329e88cf223f612 to your computer and use it in GitHub Desktop.
CSS-auto-numbered headings for HTML documents
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Numbered Headings</title> | |
</head> | |
<body> | |
<style> | |
body {counter-reset: ebene1;} | |
h1:before { | |
content: counter(ebene1) " "; | |
counter-increment: ebene1;} | |
h1 {counter-reset: ebene2;} | |
h2:before { | |
content: counter(ebene1) "." counter(ebene2) " "; | |
counter-increment: ebene2;} | |
h2 {counter-reset: ebene3;} | |
h3:before { | |
content: counter(ebene1) "." counter(ebene2) "." counter(ebene3) " "; | |
counter-increment: ebene3;} | |
</style> | |
<h1>bla</h1> | |
<h2>bla</h2> | |
<h2>bla</h2> | |
<h1>bla</h1> | |
<h2>bla</h2> | |
<h3>bla</h3> | |
<h2>bla</h2> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment