如何在电子邮件中将SVG嵌入到HTML中,以便在大多数/所有电子邮件浏览器中都可以看到它?

时间:2021-12-11 07:46:33

I want to generate graphs in SVG, and email an HTML page with those graphs embedded in it (not stored on a server and shown with linked images).

我想在SVG中生成图形,并通过电子邮件发送嵌入其中的图形的HTML页面(不存储在服务器上并显示链接图像)。

I've tried directly embedding the SVG, using the Object element, and serializing and URI encoding the SVG and specifying the whole string as a background image on a div. Nothing seems to display in Outlook 2013. Any ideas?

我尝试使用Object元素直接嵌入SVG,并对SVG进行序列化和URI编码,并将整个字符串指定为div上的背景图像。 Outlook 2013中似乎没有显示任何内容。任何想法?

1 个解决方案

#1


15  

SVG is not supported in many email clients. The best guide I’ve seen is on Style Campaign. It’s a short read that I vouch for (Anna is super smart!).

许多电子邮件客户端不支持SVG。我见过的最佳指南是Style Campaign。这是我保证的简短读物(安娜非常聪明!)。

TL;DR: A variety of technique will work in iOS mail clients and (amazingly) Blackberry. But Android, Outlook, and pretty much every desktop webmail email SVG does not support SVG and requires a fallback.

TL; DR:各种技术将在iOS邮件客户端和(令人惊讶的)Blackberry中运行。但Android,Outlook以及几乎所有桌面Webmail电子邮件SVG都不支持SVG并需要回退。

#1


15  

SVG is not supported in many email clients. The best guide I’ve seen is on Style Campaign. It’s a short read that I vouch for (Anna is super smart!).

许多电子邮件客户端不支持SVG。我见过的最佳指南是Style Campaign。这是我保证的简短读物(安娜非常聪明!)。

TL;DR: A variety of technique will work in iOS mail clients and (amazingly) Blackberry. But Android, Outlook, and pretty much every desktop webmail email SVG does not support SVG and requires a fallback.

TL; DR:各种技术将在iOS邮件客户端和(令人惊讶的)Blackberry中运行。但Android,Outlook以及几乎所有桌面Webmail电子邮件SVG都不支持SVG并需要回退。