I'm about to begin a new project at work. I need advise: the problem is that I have to hide a few galleries, images and some other blocks of content on tablets and mobile phones. Are there ways to do it smarter than just to write display:none?
Asked
Active
Viewed 34 times
0
-
Is there a reason you want to avoid `display: none?` – sol Mar 03 '17 at 12:24
-
SO is for code solution not for the advises – Deep Kakkar Mar 03 '17 at 12:24
-
The purpose is not to load useless content! Optimization for mobile devices. – Victoria Mar 03 '17 at 12:26
-
2@BrianMacKay This question is not suitable for Software Engineering. We have very similar rules to questions being too broad as Stack Overflow. If this question were to be cross posted, it would be down voted, closed, and likely deleted very quickly and that is a poor user experience. – Thomas Owens Mar 03 '17 at 13:34
-
@ThomasOwens Understood! I think I must have missed some of the meta between SO, Programmers, and SE. I will be sure to read up. – Brian MacKay Mar 03 '17 at 21:19
2 Answers
2
If you are using Bootstrap, you can add class hidden-xs
to the elements to want to hide in mobile views.
<div class="hidden-xs hidden-sm"></div> <!-- will be shown only in md lg sizes -->

Roy Bogado
- 4,299
- 1
- 15
- 31
0
You can probably use height: 0;
, but I'm not sure if it's ethical.
EDIT: This page lists the alternatives for display: none;
: CSS Alternatives to style="display:none"