代码之家  ›  专栏  ›  技术社区  ›  eozzy

Safari不在图像上显示“alt”文本?

  •  3
  • eozzy  · 技术社区  · 15 年前
    <img src="image_that_may_or_may_not_load.png" alt="Show this text if image not loaded" />
    

    Safari似乎不显示“alt”文本,以防图像未加载。我不确定其他浏览器,但火狐确实显示了替代文本。

    在电子邮件模板中显示alt文本是非常重要的,在该模板中,客户很可能会阻止图像,至少在用户接受“显示来自此用户/站点的图像”之前是如此。

    有解决办法吗?

    谢谢

    2 回复  |  直到 15 年前
        1
  •  2
  •   eozzy    15 年前

    因此,如果图像不可用,则设置图像的宽度和高度将显示alt文本,否则不会显示。

        2
  •  1
  •   Community Mohan Dere    8 年前

    尝试使用 title 属性。

    <img src="image_that_may_or_may_not_load.png" alt="Show this text if image not loaded" title="Show this text if image not loaded" />

    显然,从这里: Alt text showing in IE and firefox but not in safari? . Safari不支持。

    推荐文章