W3C home > Mailing lists > Public > w3c-wai-ua@w3.org > October to December 1999

RE: Changes in Language Techs, part 2 (was Re: Techniques for 2.2.3)

From: Jim Allan <allan_jm@tsb1.tsbvi.edu>
Date: Wed, 01 Dec 1999 12:12:08 -0600
To: "Gregory J. Rosmaita" <unagi69@concentric.net>, Marja-Riitta Koivunen <marja@w3.org>
Cc: User Agent Guidelines Emailing List <w3c-wai-ua@w3.org>
Message-id: <NBBBIBAJLBJPFGFFMBMECEGCDIAA.allan_jm@tsb1.tsbvi.edu>
Gregory wrote--
i'm still trying to figure out how to get pseudo-elements to calculate the
depth of nested list items, i.e.:


to translate to:

* level 1 list item
        + level 2 list item
                o level 3 list item
* level 1 list item
--end Gregory
Jim Comments
there are 2 ways that I know of,
first is a manual hack in a style sheet

ol:before { content : "level 1 "; }
ol ol:before { content : "level 2 "; }
ol ol ol:before { content : "level 3 "; }

the other way is more elegant. it uses the "counter" attribute of the
"content" property (this is paraphrased from Cascading Style Sheets by Lie
and Bos) see also http://www.w3.org/TR/REC-CSS2/generate.html#scope (an
excellent description of generated counters.

for example, to generate the following
1. first list item
2. second list item
	2.1 first item in sub list
	2.2 second item in sub list
		2.2.1 first item in sub-sub list

the style would look like
ol {counter-reset: itemnr } where "itemnr" is an author defined variable
li:before { content: counters(itemnr, "."); counter-increment: itemnr }

The 'counters()' function generates a string composed of the values of all
counters with the same name, separated by a given string.


The previous style sheet numbers nested list items as "1", "1.1", "1.1.1",
Received on Wednesday, 1 December 1999 13:13:55 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 20:38:24 UTC