Sasha Grievus Sasha Grievus - 5 months ago 12
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>