by clintjhill on 5/9/12, 2:02 PM with 24 comments
by Domenic_S on 5/9/12, 5:22 PM
<p><span class="fast">Red text</span></p>
with
p span.fast { color: red; }
will work just fine.
Edit: oh, I get it. You want the entire <p> tag to be red when the span starts part way through. Why not put a class on the <p>? It seems crazy counterintuitive to select elements backwards like that.
by talmand on 5/9/12, 2:45 PM
$p span.fast { color: red; }
In this case the parent is styled because it contains span.fast and the $ is the identifier .
http://davidwalsh.name/css4-preview
I've never understood what amounts to an incredibly useful feature was never considered before.
by iambot on 5/9/12, 5:00 PM
Also: the "fork me on github" and repository links are all not working / broken. FYI
by SimonSapin on 5/9/12, 4:24 PM
One of the reason we do not have the subject selector or :has() yet is that it is very hard to implement efficiently for dynamic updates. In the general case with :has(), you have to check the whole document for every DOM change.
by gcb on 5/9/12, 5:18 PM