HTML电子邮件:表或divs? [英] HTML email: tables or divs?

查看:164
本文介绍了HTML电子邮件:表或divs?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

html电子邮件时事通讯的HTML / CSS需要采用表格格式,还是可以使用具有同等保证的DIV,它将很好地显示交叉电子邮件客户端?我已经下载了一些模板,以了解它们是如何完成的,并以此为基础,并且它们似乎都使用表格。



任何洞察力都非常感谢,谢谢!

解决方案

当涉及到电子邮件HTML时,请注意web开发中的所有最佳实践都离开了这个窗口。为了保持外观一致,您应该:使用基于表格的布局

  • 使用old-学校属性样式为表

  • 仅使用内联样式,只有非常简单的样式。 < style> -tags被许多客户端丢弃。 使用< html> < head> < body> - 无论如何,它们将被大多数客户抛弃。

  • 如果您嵌入图片,请尽量确保电子邮件看起来不错,即使图片未加载。许多客户要求用户在显示图像之前将电子邮件标记为安全。
  • 这里:

    Does the HTML/CSS for an html email newsletter need to be in table format, or can I use DIVs with equal assurance it will display well cross email-client? I've downloaded a number of templates to see how they're done, upon which to base my own, and they all seem to use tables.

    Any insight much appreciated, thanks!

    解决方案

    When it comes to email HTML, note that all best practices from web development goes out the window. To make the look consistent, you should:

    1. Use table based layouts
    2. Use the old-school attribute styling for tables
    3. Use ONLY inline-styles, and only very simple such. <style>-tags are discarded by many clients.
    4. Skip using <html>, <head> and <body> - They will be discarded by most clients anyway.
    5. If you embed images, try to make sure that the e-mail looks decent even if images are not loaded. Many clients require the user to mark the email as "safe" before displaying images.

    You can read more detailed versions of the above points here:

    这篇关于HTML电子邮件:表或divs?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆