Re: Proposal: list-item-color

On Sat, 29 Sep 2001, Bjoern Hoehrmann wrote:

> * Andy wrote:
> >> The list-item-color property
> >> 
> >
> >Seconded. There's no way to achieve what this does at present and its
> >something I've often wanted/needed to do to make web documents fit
> >within my company's style guidelines. 
> 
> It is by abusing markup, e.g.
> 
>   <ul>
>   <li><span>...</span></li>
> 
> and style li and span with different colors, but as I said that's abuse
> of markup and not all markup languages provide facilities like the span
> element to achieve that presentational effect.

Actually, the way CSS2 does it is by using generated text with a 'display'
of 'marker'. Such a 'marker' will automatically replace the list-item's
own marker, like so:

    li {display: list-style}  /* This is already default in HTML */

    /* Make an explicit counter for li, instead of the implicit one: */
    li:before {display: marker; counter-increment: li-no}
    ul li:before {content: counter(li-no, disc)}
    ol li:before {content: counter(li-no, decimal)}

This is more powerful than 'list-style-color' (a better name than
'list-item-color' I think), but admittedly harder to write.

('Display: marker' is not supported by any browser so far, I believe.)


Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos/                              W3C/INRIA
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France

Received on Saturday, 29 September 2001 08:36:22 UTC