W3C home > Mailing lists > Public > www-style@w3.org > March 2007

only-child selector

From: fantasai <fantasai.lists@inkedblade.net>
Date: Fri, 09 Mar 2007 10:47:19 +1300
Message-ID: <45F08467.7000605@inkedblade.net>
To: www-style@w3.org

The :only-child selector applies to elements that are the only element
child of their parent. They can have text siblings, just not element
siblings.

I can't think of any use cases for this, but, I can think of several
for a selector that selects an element that is the only child of it's
parent and /does not/ have any text siblings aside from whitespace.

I want to be able to select

<pre>
<code>
   things like this
</code>
</pre>

but not

<pre>
things like <code>this</code>
</pre>

Can't think of any good names for it (:only-child-content?), but I'd
like to see this in some future version of CSS.

~fantasai
Received on Thursday, 8 March 2007 21:47:48 GMT

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