I have a question and I think other people may also have the same doubt ...
Let's go to the situation: I have a website, with a header edited to appear on computer screens (resolutions higher than tablets) but I would like the header to change when the site is accessed by a cell phone or tablet.
Example: I have a LOGO1280x720.PNG and would like the Logo320X70.PNG to appear when accessed by the mobile version.
I know how to hide a div at a lower resolution, but what about displaying a div in mobile version as it does?
obs: The site itself is already responsive
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=0" />
In short: I NEED A DIV SUM AND ANOTHER APPEARS IN MOBILE AND A DIV SUM AND ANOTHER APPEARS IN DESKTOP VERSION
Edit @ 2: I put it like this in HTML:
<div class="logopngdesktop"><h1 id="logo"><a href="#">Recarga de Toner e Cartuchos, Manutenção de Impressoras</a></h1></div>
<div class="logopngmobile"><h1 id="logo"><a href="#">Recarga de Toner e Cartuchos, Manutenção de Impressoras</a></h1></div>
And so in CSS:
@media only screen and (max-width: 400px) { .logopngdesktop{ display: none !important; } } @media only screen and (min-width: 601px) { .logopngmobile { display: none !important; } }
It disappears in the Mobile version but the part where it was to appear in the mobile version does not work. What can I be wrong?
SOLUTION:
Problem solved, I want to leave the resolution here for everyone who has the same problem:
Html:
<!-- aparecer no desktop -->
<div class="mobile-hide"><h1 id="logo"><a href="#">Recarga de Toner e Cartuchos, Manutenção de Impressoras</a></h1></div>
<!-- aparecer no mobile -->
<div class="mobile"><div class="desktop-hide"><h1 class="logomobile"><a href="#">Recarga de Toner e Cartuchos, Manutenção de Impressoras</a></h1></div></div>
Css:
@media only screen and (max-width: 400px) {
.mobile-hide{ display: none !important; }
}
@media only screen and (max-width: 400px) {
.mobile{ display: inline !important; }
}
@media only screen and (min-width: 500px) {
.desktop-hide{ display: none !important; }
}
Thanks to all who tried to help!