0

In css, if I write

.div1 .div2 { 
   display:none; 
}

I'm targeting a div having class div2 that is contained in a div having class div1, so div2 will be not displayed.

What if I need to do the inverse, that is not displaying div1? I mean, how do i target div1 if the only property i know about it is that div1 contains div2?

Sasha Grievus
  • 2,266
  • 5
  • 26
  • 50
  • This selects div1 only if it contain's a div2 .div1 < .div2 { display:none; } [Source][1] [1]: https://css-tricks.com/parent-selectors-in-css/ – jShoop Nov 12 '15 at 13:27
  • 1
    @coozin From the very first sentence of the article you linked: "there are no parent selectors in CSS". They've even bolded it for crying out loud! – woestijnrog Nov 12 '15 at 16:33
  • 1
    @woestijnrog it difficult to type when there's so much egg on my face – jShoop Nov 12 '15 at 16:53

0 Answers0