I want to hide all the elements in some screen resolution and just show the wanted element to be visible:
For instance:
*{
display: none;
}
#block{
display: block !important;
}
But this won't override the display property anymore. demo
I want to hide all the elements in some screen resolution and just show the wanted element to be visible:
For instance:
*{
display: none;
}
#block{
display: block !important;
}
But this won't override the display property anymore. demo
*
targets all elements within the document, including html
and body
as well. That's why the content is still hidden - verify that.
If you want to select all elements within the <body>
you should do that as follows:
body * {
display: none;
}
#block {
display: block;
}
<div id="block">block</div>
Because body
and html
are included in the universal selector *
, which has the display: none;
rule.
http://jsfiddle.net/nk8np9vo/6/
If you open the target frame with your favourite DOM inspector you'll see that <body>
remains hidden: