Ruby-on-rails 我可以在电子邮件上使用字体很棒的图标吗
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17880763/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can I use font-awesome icons on emails
提问by Mathieu
I'm developing a Rails app and we need to send emails.
我正在开发一个 Rails 应用程序,我们需要发送电子邮件。
I have installed font-awesome icons through a rails gem (https://github.com/bokmann/font-awesome-rails) (i use .scss)
我已经通过 rails gem ( https://github.com/bokmann/font-awesome-rails)安装了 font-awesome 图标(我使用 .scss)
It works fine on my webpage views but noton emails. At least gmail doesn't display them.
它适用于我的网页视图,但不适用于电子邮件。至少 gmail 不显示它们。
It is normal ? Can I use awesome fonts on email views/layout? If not, where could I find png/svg versions of awesome fonts icons so that the icons I use on my web pages are the same as those I use on my emails (for consistency)?
这是正常的 ?我可以在电子邮件视图/布局上使用很棒的字体吗?如果没有,我在哪里可以找到很棒的字体图标的 png/svg 版本,以便我在网页上使用的图标与我在电子邮件中使用的图标相同(为了一致性)?
采纳答案by idlefingers
You can't use webfonts reliably in html emails. Some clients might respect and render them, but the majority don't.
您不能在 html 电子邮件中可靠地使用 webfonts。一些客户可能会尊重并呈现它们,但大多数不会。
回答by dspacejs
You can use thiswebsite to convert the icons into images, and then simply download the images and upload them to Imgur. From there you can use <img>tags to link to the Imgur images.
您可以使用该网站将图标转换为图像,然后只需下载图像并将其上传到 Imgur。从那里您可以使用<img>标签链接到 Imgur 图像。
Edit:
编辑:
A better solution would be to host the images on your own server with the same domainas your email's domain. This will increase the chance of images automatically being displayed on your emails, as they are normally hidden until the user decides to view them.
更好的解决方案是将图像托管在您自己的服务器上,其域与您的电子邮件域相同。这将增加图像自动显示在您的电子邮件中的机会,因为它们通常是隐藏的,直到用户决定查看它们。
For example, if I used [email protected]to send emails, I'd host the images on mydomain.com
例如,如果我曾经[email protected]发送电子邮件,我会将图像托管在mydomain.com
回答by Birlla
回答by exiang
You can try to output the icons into a PNG, and include in your email HTML. If you are familiar with PHP, this open source projectat GitHub can help you automatically convert them.
您可以尝试将图标输出为 PNG,并包含在您的电子邮件 HTML 中。如果您熟悉 PHP,GitHub 上的这个开源项目可以帮助您自动转换它们。
回答by bvogelzang
You can embed them as images in your email. In order to convert them to images you can download Font Awesome to PNGin the Mac App Store. It will export PNG versions of the font awesome icons in any size or color.
您可以将它们作为图像嵌入电子邮件中。为了将它们转换为图像,您可以在 Mac App Store 中将Font Awesome下载到 PNG。它将导出任何大小或颜色的字体真棒图标的 PNG 版本。
https://itunes.apple.com/us/app/font-awesome-to-png/id826676932?ls=1&mt=12
https://itunes.apple.com/us/app/font-awesome-to-png/id826676932?ls=1&mt=12

