2010-06-17 168 views
3
<img src="image_that_may_or_may_not_load.png" alt="Show this text if image not loaded" /> 

如果图像未加载,Safari似乎不会显示'alt'文本。我不确定其他浏览器,但Firefox确实显示了替代文字。Safari不会在图像上显示'alt'文字?

在电子邮件模板中显示替代文本非常重要,在这些模板中图像将被客户端阻止,至少在用户接受“显示来自该用户/站点的图像”的情况下。

任何解决方法吗?

感谢

回答

2

所以事实证明,设置图像的宽度和高度将显示替代文本,因为图像不可用,否则不会。

+1

你只需要设置宽度 – Cine 2010-11-17 08:43:18

+0

它仍然会显示令人讨厌的蓝色问号 – 2012-03-13 10:20:11

1

尝试使用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不支持它。

+1

没有,没有变化。 Safari只显示一个蓝色的问号占位符,有时甚至没有。 – 3zzy 2010-06-17 05:13:34