W3C home > Mailing lists > Public > www-style@w3.org > January 2005

[CSS3] pseudo class for "current element"

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Tue, 25 Jan 2005 15:59:10 -0800
Message-ID: <006701c50339$dd737e00$c302000a@internal.toppro.net>
To: <www-style@w3.org>
I am designing a set of "style capable" HTML input widgets 
to be able to define something like this:

select:focus option[selected]
{
   background-color: navy;
}

e.g.: http://terrainformatica.com/hsmile/images/controls.jpg

but have found that CSS is missing a concept of "current element".

For example: 
<select> element (list box) is "focusable" element but its <options> are not. 
Being in focus, <select> has one current item (option) which is visually distinct from others. 

My first idea was to use :active pseudo class as a selector for current element but 
current role of :active is to show 'pressed' state primarily. 
Moreover :current item could be in active (pressed) and non-active (not pressed) state.

Probably I've missed something in list of planned pseudo-classes for CSS3?

Other possible solution for particular problem with <select> and <option> could be to 
make <option> "focusable" but in this case other problem arises: 

There are no selector for situation:

select-which-contains-option-in-focus
{
   border: 1px solid red;
}

I mean it is lack of "containment" selectors like:

P < DIV  - any <div> which contains <p> 
* < DIV  - non empty div 
OPTION:focus < SELECT  - select having option in focus. 

Thanks in advance,

Andrew Fedoniouk.
http://terrainformatica.com
Received on Tuesday, 25 January 2005 23:59:13 GMT

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