by Juliet Kemp
I am in the process of rewriting the work website to be all CSS-shiny, standards compliant, easy to update, all that jazz. During which I have been led to really wish that CSS had a "has child" selector. It is of course possible to fake it, but you have to do it in the markup (by using a "has-child" class) which is suboptimal. Thankfully it's the navigation that needs this, for which I use server-side includes, so I only have to do it in one place; but it makes my nice tidy markup messy!
I went looking for whether CSS3 would feature this. Nothing on the CSS3 Roadmap (2001? Blimey, that's old.) It does though mention that selectors will be extended. However, the most recent CSS3 selector document doesn't give has-child as one of the selector extensions. So I guess that's a no. A shame.
|You probably wouldn't want to be relying on anything in CSS3 being implemented any time soon anyway...|
Linuxchix rocks! We are fun and geeky and mostly pleasant!
|I believe the :empty selector does what you want, except inverted. IIUC, this is supported in Fx 2.0+, Opera 9.5, Safari 2.0+, and Konqueror 3.5.4+. Maybe IE8?|
I so much prefer CSS to tables... much easier to read!