-1

Is it possible to hide a previous element if an element is :target in pure css?

section:not(:target){
 display:none;
}
section:target{
 display:block;
}
section.main{
 display:block;
}

<section class='main'>
...
</section>
<section id='test'>
...
</section>

Now I need to hide section.main if #test is :target.

1 Answers1

0

You can use this in your CSS

visibility: hidden;