If faced with the following scenario, how would you handle it?
Imagine this: You need to hide a visible element when a specific media query is met:
.myElement {
display: block;
}
and the media query to hide it:
@media (min-width: 1000px) {
.myElement {
display: none;
}}
Now, if you want to show a hidden element when a media query is met.
You start by setting its display to none:
.myElement {
display: none;
}
Then, after using a particular media query for some time and you decide to show it again, so you use:
@media (min-width: 1000px) {
.myElement {
display: block;
}}
However, now many myElements are using flex layout while others are using block layout, causing the media query to malfunction.
Is there a way to create a media query where it can make the element visible regardless of its display type?
@media (min-width: 1000px) {
.myElement {
display: initial;
}}
In case the display property is not set on the element class, how does it work? You might specify that the element is currently using Flex but should initially be hidden and then restore a previously defined value:
.myElement {
display: flex;
display: none;
}
Does this concept make sense?