yet another web agency

css counter reset


Ovvero, come resettare il contatore in una lista, utilizzato nel testo A Christmas Carol (C. Dickens) pubblicato su DidaSfera.

  1. First of all Marley was dead, no doubt about that. Really, as
  2. dead as a door-nail. This must be distinctly understood, or nothing
  3. wonderful will ever come of this story.
  4. Scrooge, however, had not painted out Old Marley’s name.
  5. Seven years after his death, his partner’s name still stood above the
  6. warehouse door: Scrooge and Marley. People who did not know the
  7. company sometimes called Scrooge “Scrooge”, sometimes called him
  8. Marley. But Scrooge did not mind what he was called.
  9. He was a hard man, as hard as stone, with a lot of money, but no
  10. friends, and always lived alone. His heart was frozen, and so was his

ol.verse { font-style:italic; counter-reset: line; width: auto; margin: 0 auto; }
ol.verse li { display: block; }
ol.verse li:before { counter-increment: line 1; content: counter(line); width: 2em; display: block; float: left; margin-left: -2em; }
ol.verse li:not(:nth-child(5n)):before {
visibility: hidden;

Maggiori info qui

Have a Comment?

Some HTML is OK