1

Is it possible to create a CSS selector, which selects the div.outer element, which contains div.good-inner? Example:

<div class="outer">
    <!-- this is good -->
    <div class="good-inner">This gets selected!</div>
</div>
<div class="outer">
    <!-- has `outer` as class, but doesn't have `good-inner` inside of it -->
    <div class="bad-inner">This doesn't.</div>
</div>
<div>
    <!-- has `good-inner`, but doesn't possess `outer` as class --> 
    <div class="good-inner">Neither does this.</div>
</div>
winwin
  • 958
  • 7
  • 25
  • 1
    Nope. No parent or ancestor selector yet – j08691 Oct 26 '21 at 14:54
  • 3
    That is only possible with [`:has()` in CSS Selectors level 4](https://developer.mozilla.org/en-US/docs/Web/CSS/:has), which isn't implemented in any browsers yet. – Terry Oct 26 '21 at 14:54

0 Answers0