Skip to content

Instantly share code, notes, and snippets.

@josuebasurto
Forked from anonymous/index.html
Created August 22, 2012 00:01
Show Gist options
  • Save josuebasurto/3420642 to your computer and use it in GitHub Desktop.
Save josuebasurto/3420642 to your computer and use it in GitHub Desktop.
Numbered Heading in HTML and CSS
<html>
<head></head>
<body>
<h1>My Article</h1>
<h2>Introduction</h2>
<h3>Rationale</h3>
<h2>Background</h2>
<h1>My Article</h1>
<h2>Introduction</h2>
<h2>Introduction</h2>
<h2>Introduction</h2>
</body>
</html>
body {
counter-reset: h2counter;
}
h1 {
counter-reset: h2counter;
}
h2:before {
content: counter(h2counter) ".\0000a0\0000a0";
counter-increment: h2counter;
counter-reset: h3counter;
}
h3:before {
content: counter(h2counter) "." counter(h3counter) ".\0000a0\0000a0";
counter-increment: h3counter;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment