css2 - 6.3 Attribute selectors

Thinking of alternatives to 'first' and 'last' pseudo-classes...

How about adding two built-in dynamic attributes for sibling number and
sibling position[1]? These would be valueless attributes that reflect the
order on the page of like-element siblings. For general elements, this
number/position would include any classes and/or IDs. A separate
number/position would be kept for each class and ID. Examples:

  P [1] { ...      /* The first P among sibling Ps */

  P [first] {...   /* likewise */

  P [2] { ...      /* The second P among sibling Ps */

  P [last] {...    /* the last P among sibling Ps */


David Perrell

[1] http://www.w3.org/TR/WD-CSS2/selector.html#h-6.3

Received on Tuesday, 25 November 1997 17:46:05 UTC