Sasha Grievus Sasha Grievus - 1 month ago 5x
CSS Question

How to hide all element on html page except one div using css?

I was trying to hide all on an html expect for one

, as part of a bigger problem.
I have tried...

body * {
display: none;
#someTable, #someTable * {
display: block !important;

But It doesn't work. What am i doing wrong?


You can use the pseudo-class ':not()'

   body *:not(.myDiv) {
        display: none;

<div class="myDiv">2</div>