Re: [CSS2.1] Why is counter incremented before it's used?

On Wed, Jan 11, 2012 at 2:47 PM, Jack Smiley <zxcv_890@hotmail.com> wrote:
> Yes, I thought there was good reason... I just wish I could understand it!
> Would you (or another list member) be so kind as to flesh out this
> explanation a bit?

Here's a silly example:

<ul>
  <li>one
  <li class=skiptwo>maybe three?
  <li>four
</ul>
<style>
li.skiptwo { counter-increment: list-item 2; }
</style>

This works right now.  If, on the other hand, counter-increment's
effect happened *after* the counter value as actually used, you'd
instead have to put the .skiptwo class on the first li.

But really, the main reason is just that properties pretty much always
have an effect on the element they're specified on, and breaking that
pattern is confusing.

~TJ

Received on Thursday, 12 January 2012 17:20:39 UTC