Reputation: 4219
My html looks something like this:
<div id="whatever">
<div>
<p></p>
<p></p>
</div>
<div>
<p></p>
<p></p>
<p></p>
</div>
<div>
<p></p>
</div>
</div>
Now, I would need to select all p
elements, except the ones in the last div
in the "whatever" one. I tried #whatever>:not(:last-child)div>p
, but didn't seem to work. Any help would be appreciated.
Upvotes: 1
Views: 67
Reputation: 101533
You have the order wrong. It should be this:
#whatever > div:not(:last-child) > p
(spaces added for readability)
If you specify a tag, the tag always comes first in that level of the selector.
Upvotes: 10