I have a div element that I want to hide when the width of the browser is less than or equal to 1026px. Is this possible to do with the css: @media only screen and (min-width: 1140px) {}
If it isn't possible with css, Is there any alternative?
Extra info: When the div element is hidden, I don't want a blank white gap. I'd like the page to flow as it would if I deleted the div element entirely from the code.
The div I am hiding is <div id="fadeshow1"></div>
.
HTML5 Doctype.
I used javascript to place a gallery into that div.
I want it to look like this when it is bigger than 1026px width:
I want it to look like this when it is less than 1026px width:
To hide an element in a responsive layout, we need to use the CSS display property set to its "none" value along with the @media rule. The content of the second <p> element having a "hidden-mobile" class will be hidden on devices smaller than 767px.
We hide the divs by adding a CSS class called hidden to the outer div called . text_container . This will trigger CSS to hide the inner div.
You can do this with CSS:
@media only screen and (max-width: 1026px) { #fadeshow1 { display: none; } }
We're using max-width
, because we want to make an exception to the CSS, when a screen is smaller than the 1026px. min-width
would make the CSS rule count for all screens of 1026px width and larger.
Something to keep in mind is that @media
queries are not supported on IE8 and lower.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With