开发者

CSS parent-of selector? [duplicate]

This question already has answers here: Closed 11 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜