W3C home > Mailing lists > Public > www-style@w3.org > March 2002

Re: OL starting with zero

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 26 Mar 2002 19:05:33 +0000
Message-ID: <3CA0C67D.4050305@hixie.ch>
To: Coises <Randy@coises.com>
CC: www-style@w3.org
Coises wrote:
> 
> The current working draft of the CSS3 Lists module, at:
>      http://www.w3.org/TR/2002/WD-css3-lists-20020220
> proposes to solve such problems by exposing the "list-item" counter.
> 
> Neither the original definition of "display: list-item" in CSS1, nor its
> reiteration in CSS2, nor the new specification in the working draft ---
> which says it intends to be compatible with the CSS1 usage --- explains how
> to determine when the list-item counter gets reset when using only the
> "display: list-item" property of CSS1 (without the counter properties of
> CSS2-3).

Actually, it does -- by default it just gets reset on the root element, since it 
is not explicitly mentioned anywhere else.


 > I am a bit doubtful that CSS1 compatibility and intuitive
> behavior with an exposed counter can be achieved simultaneously; as far as
> I can tell, no one has yet attempted to explain how it will work.

I fail to see the problem with the way the Lists module specifies it. Maybe the 
following can help. This is what we intend to add as an appendix at the end of 
the lists module, showing an example of how CSS can be used to describe the 
typical presentation of the HTML4 list elements:

  /* Set up list items */
  li { display: list-item;
       /* counter-increment: list-item; (implied by display: list-item) */ }

  /* Set up ol and ul so that they reset the list-item counter */
  ol, ul { counter-reset: list-item; }

  /* Default list style types for ordered lists */
  ol { list-style-type: decimal; }

  /* Default list style types for unordered lists up to 8 deep */
  ul { list-style-type: disc; }
  ul ul { list-style-type: square; }
  ul ul ul { list-style-type: circle; }
  /* And so on ad nauseum:
  ul ul ul ul { list-style-type: box; }
  ul ul ul ul ul { list-style-type: disc; }
  ul ul ul ul ul ul { list-style-type: square; }
  ul ul ul ul ul ul ul { list-style-type: circle; }
  ul ul ul ul ul ul ul ul { list-style-type: box; }
  */

  /* The type attribute on ol and ul elements */
  ul[type="disc"] { list-style-type: disc; }
  ul[type="circle"] { list-style-type: circle; }
  ul[type="square"] { list-style-type: square; }
  ol[type="1"] { list-style-type: decimal; }
  ol[type="a"] { list-style-type: lower-alpha; }
  ol[type="A"] { list-style-type: upper-alpha; }
  ol[type="i"] { list-style-type: lower-roman; }
  ol[type="I"] { list-style-type: upper-roman; }

  /* The start attribute on ol elements */
  ol[start] { counter-reset: list-item attr(start, integer);
              counter-increment: list-item -1; }

  /* The value attribute on li elements */
  li[value] { counter-reset: list-item attr(value, integer);
              counter-increment: none; }

  /* The above rules don't fully describe HTML4 lists, since they do not cover
     behaviours such as margins and the like. The following rules could be used
     for this purpose:

     ol, ul { display: block; margin: 1em 0; padding-left: 2.5em; }
     ol ol, ol ul, ul ul, ul ol { margin-top: 0; margin-bottom: 0; }
     li::list-marker { margin-right: 1em; text-align: right; }

  */

I would love to hear any comments you have on this draft and how it should be 
improved.

Cheers,
-- 
Ian Hickson
``The inability of a user agent to implement part of this specification due to
the limitations of a particular device (e.g., non interactive user agents will
probably not implement dynamic pseudo-classes because they make no sense
without interactivity) does not imply non-conformance.'' -- Selectors, Sec13
Received on Tuesday, 26 March 2002 14:05:44 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:13 GMT