0

How can I customize the numbers created when using the following CSS:

div.Most ol{counter-reset: item;}
div.Most ol li:before {content: counter(item) "  "; counter-increment: item}

By adding these lines to my ordered list, I obtain a numerical value starting from zero to the number of items in my list. What I want is to control the values manually. Say I want the first item to have value 2 and the second 4 and so forth.

Is it possible?

user1535882
  • 119
  • 1
  • 3
  • 12
  • possible duplicate of [Is it possible to specify a starting number for an ordered list with css?](http://stackoverflow.com/questions/779016/is-it-possible-to-specify-a-starting-number-for-an-ordered-list-with-css) – j08691 Jul 24 '12 at 17:36
  • Sure it is possible but you should avoid logics in your CSS. I suggest Javascript instead. – EricG Jul 24 '12 at 17:32
  • okey what about decimal values ranging between 0.1 and 0.9 – user1535882 Jul 24 '12 at 18:28

1 Answers1

0

If you want to always increment by 2, you can set that as the counter-increment value:

div.Most ol li:before {content: counter(item) "  "; counter-increment: item 2}

This is documented in the spec.

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356