1

I have this scenario

  <div>
      <div>
        <i>italic text</i>
      </div>
  </div>

I am seeking to choose just the first div, the one that does not contain <i> as children. I am out of curiosity about how to do it the :not pseudo-selector. Some examples that didn't work for me:

- div > :not(i)
- div:not(div > i) 
- div:not( > i)
- div:not(div > i)
- :not(div > i) 

Any ideas of how to achieve it without class selectors and with :not selector?

j08691
  • 190,436
  • 28
  • 232
  • 252
Ruffeng
  • 407
  • 5
  • 17
  • All these would select the `i` element, not the `div`. It isn't possible with pure CSS to select (or filter) a parent element, which the `div` *is* in relation to the `i`. You'll need javascript/jQuery for this. – Johannes Jun 05 '20 at 17:43

0 Answers0