W3C home > Mailing lists > Public > www-style@w3.org > February 2008

Collapsing elements (was: [CSS3] Proposal to add list-style-type: tree-line value)

From: Bert Bos <bert@w3.org>
Date: Thu, 21 Feb 2008 00:16:23 +0100
Message-ID: <47BCB4C7.8000006@w3.org>
To: www-style <www-style@w3.org>

Daniel Glazman wrote:
> Andrew Fedoniouk wrote:
>> I think it makes sense to add another value to the list-style-type 
>> enumeration - "tree-line".
> Wow, that's far more than stylistic Andrew... That's clearly
> behavioural. But that is only a part of the solution needed for
> UL/LI turned into foldable trees. We need a queryable way to specify an
> item is folded or not too... Right ?

Actually, I think I like it...

It's a very easy way to get a tree-like list display. I can do without 
detailed control over the look of the lines.

I want collapsing elements in CSS, too, but it is unrelated to how lists 
are decorated. I think the best idea I've come up with so far is the 
':initial' pseudo-class.


     ul:initial {content: attr(title)}
     ul {content: contents}

This says that (1) ul has an alternative state and the browser should 
therefore allow the user to toggle the element between states (the 
method depends on the browser, but a left click or the enter key seem 
good choices); (2) in the initial state, the ul shows its title 
attribute; (3) in the other state, the ul shows its normal content, 
i.e., the list items. (Actually, the second rule is the default and can 
be omitted.)

Another example:

     div:initial * {display: none}
     div:initial h2 {display: block}

       <h2>Heading of this section</h2>
       <p>First paragraph...

I hope it is pretty obvious what this does...

   Bert Bos                                ( W 3 C ) http://www.w3.org/
   http://www.w3.org/people/bos                               W3C/ERCIM
   bert@w3.org                             2004 Rt des Lucioles / BP 93
   +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Wednesday, 20 February 2008 23:16:53 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:34 UTC