0
header nav.active
{
    body
    {
        overflow-y: hidden;
    }
}

Is something like that possible or would I have to be doing that with Javascript?

Keimeno
  • 1,893
  • 6
  • 22
  • … either via JS – or via a different structure and CSS selectors to begin with. Whatever the `active` class on the `nav` element is supposed to achieve, should be able to be rewritten to `body.active header nav { … }` - and then you can also style body directly, based on whether it has that class or not. (If that class is dynamically set via scripting, that part would of course need modifying accordingly as well then.) – 04FS Mar 06 '19 at 12:50

1 Answers1

-4

No, this is not possible with plain CSS.

Mateusz Mania
  • 799
  • 3
  • 15
  • My answer is valid, so I don't understand negative vote. Question is following: "Is something like this possible in CSS?". – Mateusz Mania Mar 06 '19 at 12:51
  • I think people don't get the question, thanks for your answer though. I have now made it with JQuery. Seems like this was the only option $('body').toggleClass('active'); – Keimeno Mar 06 '19 at 13:45
  • You solution is proper way. Btw. please approve my answer :) – Mateusz Mania Mar 06 '19 at 16:34