我正在为我的公司制作电子邮件模板。取决于它是移动设备还是浏览器,我正在尝试显示内容。
显示属性似乎不适用于 gmail,我无法在此处粘贴整个代码。这是我使用的媒体查询。
@media only screen and (max-device-width: 380px) {
.mobileWidth {
width: 290px !important;
}
img {
max-width: 130px !important;
max-height: 130px !important;
}
.right {
width: 100% !important;
position: relative !important;
}
.test {
width: 290px !important;
text-align: center !important;
}
.showMobile {
display:inline !important;
}
.hideMobile {
display: none;
}
}
<html>
<body>
<!-- this div block is intended to by default not show in the browser and show in the mobile -->
<table>
<tr>
<td>
<div class = "showMobile" style ="display:none;">
<p> some text and image <p>
</div>
<!-- this div block is intended to be shown in the browser and not shown in the mobile -->
<div class="hideMobile">
<p> some other text and image </p>
</div>
</td>
</tr>
</table>
</body>
</html>
这在 iphone 邮件帐户中运行良好,但不适用于 gmail 浏览器和 iphone 的 gmail 应用程序。任何指针?