【问题标题】:HTML Email image not showing on mobile email clientsHTML 电子邮件图像未显示在移动电子邮件客户端上
【发布时间】:2013-07-10 10:44:14
【问题描述】:

我正在尝试创建一个 html 电子邮件通讯,并且我必须使用媒体查询将一张图片替换为另一张图片。它在桌面客户端上工作,我可以看到图像发生了变化,但在手机上,图像根本不显示。

有人有这方面的经验吗?

header_mobile 是 display: none;在媒体查询之外,ofc。

html:

<td id="header" align="center" >
      <a href="http://ezzence.dk">
             <img src="http://www.thomasteilmann.com/nyhedsbrev/img/header.jpg" alt="Ezzence Nyhedsbrev" />
      </a>
</td>
<td id="header_mobile" align="center" >
      <a href="http://ezzence.dk">
             <img src="http://www.thomasteilmann.com/nyhedsbrev/img/mobile/header.jpg" alt="Ezzence Nyhedsbrev" />
      </a>
</td>

css:

#header_mobile{
    display: table-cell;
 }

 #header{
    display: none;
 }

【问题讨论】:

  • 你用过哪些手机邮件客户端?
  • 股票 android 4.0 和 ihpone 4 股票客户端
  • 当我在浏览器中检查它(手动调整大小)时,它工作得很好
  • 哪些特定的电子邮件客户端? Hotmail、Gmail 等?
  • android 4.0 上的股票电子邮件客户端,不使用 gmail 应用程序或任何东西。 iphone上也一样

标签: html css media-queries html-email


【解决方案1】:

iPhone 和 Android 4 默认客户端都支持媒体查询,所以这不是问题。似乎您的媒体查询没有触发。

不确定您将媒体查询设置为什么,但这应该适用于这些设备:

@media only screen and (max-width: 479px) { display:table-cell !important; }

不要忘记 !important 部分。 max-device-width 和 max-width 之间也存在差异,因此只需检查每个设备的范围。

【讨论】:

  • 非常感谢。有时这是您在漫长的一天后忽略的小事:)
猜你喜欢
  • 2017-03-17
  • 2018-07-04
  • 2010-11-13
  • 1970-01-01
  • 2014-07-10
  • 2011-10-17
  • 2012-11-25
  • 2011-08-06
  • 1970-01-01
相关资源
最近更新 更多