【问题标题】:Hide elements in HTML-mails on Apple Mail在 Apple Mail 上隐藏 HTML 邮件中的元素
【发布时间】:2014-06-10 08:57:24
【问题描述】:

当 Apple 邮件客户端(桌面操作系统和 iOS 上的 Apple Mail)查看 HTML 邮件中的元素(例如 s 或 s)时,有没有办法隐藏它们?

也许有一个通过 CSS 的 -webkit 属性的简单方法?

【问题讨论】:

    标签: html email html-email email-client


    【解决方案1】:

    我认为您可以使用媒体查询来做到这一点,这里有一些额外的代码。然后通过使用显示 none 或 block 您可以隐藏元素。 我希望您了解媒体查询。

     <!-- iPhone standard resolution 320x460  (landscape not needed because all web apps start portrait on iPhone) -->
    <link  rel="apple-touch-startup-image" href="splash-320x460.jpg" media="(device-width: 320px)" />
    <!-- iPhone high resolution (retina) 640x920 pixels (landscape not needed because all web apps start portrait on iPhone) -->
    <link rel="apple-touch-startup-image" href="splash-640x920.jpg" media="(device-width: 320px) and (-webkit-device-pixel-ratio: 2)" />
    <!-- iPad Portrait 768x1004 -->
    <link rel="apple-touch-startup-image" href="splash-768x1004.jpg" media="(device-width: 768px) and (orientation: portrait)" />
    <!-- iPad Landscape 748x1024 (yes, a portrait image but with content rotated 90 degrees - allows 20px for status bar) -->
    <link rel="apple-touch-startup-image" href="splash-748x1024.jpg" media="(device-width: 768px) and (orientation: landscape)" />
    <!-- iPad retina Portrait 1536x2008 -->
    <link rel="apple-touch-startup-image" href="splash-1536x2008.jpg" media="(device-width: 768px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 2)" />
    <!-- iPad retina Landscape 1496x2048 (yes, a portrait image but with content rotated 90 degrees - allows 40px for status bar) -->
    <link rel="apple-touch-startup-image" href="splash-1496x2048.jpg" media="(device-width: 768px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 2)" />
    

    【讨论】:

    • 谢谢,看起来像是一个选择。像 iMac 这样的非移动设备也可以吗?
    • 是的,有可能。有关详细信息,请参阅此链接。在这里,您还可以找到 iMac 的不同设备配置。 a2zwebhelp.com/media-width-for-responsive-design
    【解决方案2】:

    是的,但仅适用于 iOS 设备。 Here's a full list.

    但是,尝试通过媒体查询检测桌面 Mac 几乎是不可能的。大多数 iMac 的显示屏为 1920x1080,与所有 1080p 显示器相同。他们的笔记本电脑也会有同样的问题。而且您不能在电子邮件中使用 javascript,因此无法以这种方式进行浏览器嗅探。

    最重要的是,Apple Mail 不像 GMail 和 Yahoo 等网络邮件服务那样受欢迎,后者会剥离任何媒体查询。

    【讨论】:

      猜你喜欢
      • 2021-01-20
      • 2018-06-21
      • 2014-07-15
      • 2011-12-04
      • 1970-01-01
      • 2011-12-28
      • 2010-09-27
      • 1970-01-01
      • 2023-03-15
      相关资源
      最近更新 更多