CSS parent-of selector? [duplicate]
Possible Duplicate:
Is there a CSS parent selector?
Consider this markup:
<div>
<div>
<p id="my_paragraph">Squ开发者_开发技巧irrels!</p>
</div>
<div>
<p>Nuts</p>
</div>
<div>
Is there a CSS selector that would select the first nested div
by the fact that it contains a specific p
? Something like :parent-of(p#my_paragraph)
It's not possible, as discussed in this stackoverflow question. And as quoted by David Hyatt, a webkit developer:
With parent selectors it becomes extremely easy to accidentally cause a document-wide grovel. People can and will misuse this selector. Supporting it is giving people a whole lot of rope to hang themselves with.
精彩评论