Return to Snippet

Revision: 68051
at November 19, 2014 13:40 by ngocviet


Initial Code
body {
    counter-reset: chapter;      /* Create a chapter counter scope */
}
h1:before {
    content: "Chapter " counter(chapter) ". ";
    counter-increment: chapter;  /* Add 1 to chapter */
}
h1 {
    counter-reset: section;      /* Set section to 0 */
}
h2:before {
    content: counter(chapter) "." counter(section) " ";
    counter-increment: section;
}

Initial URL
https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Counters

Initial Description
two properties:
* counter-reset
* counter-increment
This example shows a way to number chapters and sections with "Chapter 1", "1.1", "1.2", etc.

Initial Title
CSS counter styling

Initial Tags
css, html

Initial Language
CSS