- This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
Viewing 9 posts - 1 through 9 (of 9 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
How do i make a div/image disappear when the screen reaches a certain width using media queries?
Disappear how?
Remove it from the DOM or just hide it?
I don’t think he means removing from the DOM. Anyway, that couldn’t be done. But you could hide it.
@media (max-width: 40em) {
.element {
display: none;
}
}
>I don’t think he means removing from the DOM. Anyway, that couldn’t be done
With JS you could…couldn’t you?
@media (max-width: 40em) {
img {
visibility:hidden;
}
}
also works…you can simply give the width…here “max-width” means devices less than width of or equal to…
display:none
is not the same as
visibility:none
http://codepen.io/Paulie-D/pen/39b45717797e5d4068d87de01c949386
> With JS you could…couldn’t you?
That would be too easy.
> With JS you could…couldn’t you?
Very easily, but that would require JS to do something you could (and have to) do with CSS only (Media Queries).
@Paulie_D : got it! thanks :(