I am trying to make a <div>
only visible on mobile.
Inside the <head>
tag I have:
<style>
@media only screen and (min-device-width: 481px) {
div[class="mobile-only"] {
height: 0px !important;
overflow: hidden !important;
}
}
@media only screen and (max-device-width: 480px) {
div[class="mobile-only"] {
height: auto !important;
overflow: auto !important;
}
</style>
And in the HTML:
<div class="mobile-only">
<table...>
</div>
I have tried a gazillion (roughly) different ways of getting this to work, such as display: none;
but GMail just seems to totally ignore the media query and show the <div>
regardless.
Is there a trick to this? It works in my Outlook client.