W3C home > Mailing lists > Public > www-style@w3.org > April 2011

[css3-lists] Opinion on the 'range' descriptor

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 27 Apr 2011 14:52:22 -0700
Message-ID: <BANLkTinBO04T77fGYz38DLd36+K2qcpaaQ@mail.gmail.com>
To: www-style list <www-style@w3.org>
Right now counter styles have a 'range' descriptor, which defines an
explicit range for the style.  Counter styles also have implicit
ranges based on their algorithm; for example, numeric styles have an
implicit range of [-inf,inf], while alphabetic styles have an implicit
range of [1,inf].

Hakon observed that there doesn't seem to be a good use-case for
explicit ranges on any type except additive, and I think he's probably
right.  I can only come up with a single case where it can be useful,
as an alternate way to define "fixed-width numeric" styles:

@counter-style decimal-fixed-3-1 {
  type: override decimal;
  range: 0 9;
  prefix: '00';
}

@counter-style decimal-fixed-3-2 {
  type: override decimal;
  range: 10 99;
  prefix: '0';
  fallback: decimal-fixed-3-1;
}

@counter-style decimal-fixed-3 {
  type: override decimal;
  range: 100 999;
  fallback: decimal-fixed-3-2;
}

(You then actually use the decimal-fixed-3 style in your code - the
other two are helpers only.)

(There's another slightly more hacky way to do this using alphabetic
styles and counter-reset, too.)

I don't know if this is valuable - if this particular use-case is
valuable, I'd rather support it explicitly with a numeric-fixed-width
type or something.  Are there other use-cases for an explicit range
descriptor?

~TJ
Received on Wednesday, 27 April 2011 21:53:09 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:39 GMT