HTML email: tables or divs?

HtmlHtml Email

Html Problem Overview


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!

Html Solutions


Solution 1 - Html

> ⚠️ Update 2021-06-10: This is a very old answer. I'm not sure how accurate it is 10 years after it was written. Mail clients are hopefully more compliant today ⚠️

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:

Solution 2 - Html

Like everyone here has said, use tables and inline all your css... but there is an ecosystem of email apps to help you build emails.

I've been using Mailrox (https://www.mailrox.com/) for most of my email builds recently and it seem to be pretty damm good and outputting perfect HTML emails, if you're building one from a design, even though it's in beta.

You could also try pre-built templates from Mailchimp or Campaign Monitor, but it sounds like you have a design for your email so maybe Mailrox would be best.

If you really want to get into building emails I'd say forget most of what you know about modern webdesign and master table layouts and use the links from PatrikAkerstrand.

Litmus is also great for testing your hand-coded designs. They give you previews of your email in (pretty much) all the email clients.

Hope this helps.

Solution 3 - Html

Many email-clients aren't able to render css. I would use tables to format your mail and use images for anything else.

Solution 4 - Html

As it's already been mentioned - your HTML emails should be built using tables (and not divs). You can add CSS as well - both using an external stylesheet, but this will not be picked up by all email clients, so it's actually more reliable to add your css in-line. Even when doing so, some attributes might be ignored by certain email clients, so your best bet is still using HTML attributes whenever these are available. "You must do this because the some clients, such as Gmail, will ignore or strip out your

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionHandiworkNYC.comView Question on Stackoverflow
Solution 1 - HtmlPatrikAkerstrandView Answer on Stackoverflow
Solution 2 - HtmlCafeHeyView Answer on Stackoverflow
Solution 3 - Htmlfb55View Answer on Stackoverflow
Solution 4 - HtmlAlexandraView Answer on Stackoverflow