W3C home > Mailing lists > Public > www-style@w3.org > October 2004

"active" CSS

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Sat, 09 Oct 2004 13:37:02 -0700
To: www-style@w3.org
Message-id: <41684BEE.6000304@terrainformatica.com>

I've got a task: to emulate behaviour of XHTML2 <nl> element
(collapsible list/"tree") using CSS solely.

After some experiments I came up with the following solution. I've 


pseudo class and function

   set-parent-attribute(  <attribute-name> , <attribute-value> )

This function sets attribute <attribute-name> of element's parent to

Having this I defined following statements in my stock style sheet for nl>li
and nl>label:

nl>li  {  display:list-item;  }
nl[state="close"]>li { display:none; }

nl>label:on-click {  set-parent-attribute ( state, "close"); }
                  {  set-parent-attribute ( state, "open");  }

Following HTML with the style applied defines such
collapsible list (tree):

   <li href="#introduction">Introduction</li>
          <li href="#may">May</li>
          <li href="#must">Must</li>
          <li href="#should">Should</li>
   <li href="#conformance">Conformance</li>

In fact I was using initially full set of on-mouse, on-focus, on-key, 
etc. "CSS event
connectors".  Instead of the 'set' function I was using names of functions
implemented in script  (my c-smile language: 
http://c-smile.sourceforge.net )
Script functions reside in associated <script> block.

During this experiments I have discovered that surprisingly many current
typical HTML/JavaScript use cases seen on the web
could be implemented by the "on-click" and couple of simple "state-switch"
functions like 'set' I mentioned before.
I mean that many dynamic effects (e.g. <nl>, popup menus, etc.) could be 
defined without any
script at all - just in "pure" CSS.

This message is not a proposal in any sense.
It is just my thoughts aloud about "CSS and active elements" and "CSS and

I would appreciate any creative comments on the subject...
E.g. "set-parent-attribute" is not universal enough.
Some other function, with additional parameter defining
"relative path" of target element, should be designed.
And of course: does all of this make any sense?


Andrew Fedoniouk.
Received on Saturday, 9 October 2004 20:38:43 UTC

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