1

Possible Duplicate:
Is there a CSS parent selector?

Consider this markup:

<div>
  <div>
    <p id="my_paragraph">Squirrels!</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)

Community
  • 1
  • 1
Konrad Garus
  • 50,165
  • 42
  • 145
  • 220
  • [Is there a CSS parent selector?](http://stackoverflow.com/questions/1014861/is-there-a-css-parent-selector) **No, there is not.** (And this comes up as one of the first auto-suggested questions in the Ask Question page when you type that title.) – BoltClock Jul 29 '11 at 13:28
  • @BoltClock you're right, it's a duplicate. Didn't notice. Sorry! – Konrad Garus Jul 29 '11 at 13:34

1 Answers1

0

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.

Community
  • 1
  • 1
Vap0r
  • 2,418
  • 2
  • 19
  • 35