---
title: Tips & Tricks
description: We've put together some Responsive Emails Tips & Tricks that will help you navigate the mine field that is coding HTML emails.
---
Coding responsive emails can be a real pain. This guide will help you through some of the the most common issues you'd face. It's a living document and will get updates periodically.
## Why Foundation for Emails
Most responsive emails are built on templates. They’re simple, easy to drop content into and are usually well-tested. Templates have a serious cost though. "Oh, so you want to do anything other than change the colors and text?" Sorry … you’re out of luck, Chuck. Templates tend to be hard to customize heavily or to extend. For that you need a framework.
A framework is a collection of reusable code and design patterns which gives users a solid, tested base upon which to build. Not a bunch of visual styles you can just bolt on as an afterthought and call it a day.
- Frameworks give you the solid base of a template, but the extensibility of custom code. You can make your template fit your content, not the other way around.
- Additionally, a framework gives you a common codebase to structure your projects around. So if new team members work on the project, they don't have to re-invent the wheel. You can spend less time coding your email and more time optimizing your campaigns.
## Need to know
The sad truth about creating or coding HTML emails is that tables are the only things that are universally supported when it comes to email design. If you came from the world of building websites, this may seem like a stepping into Doc Brown's Delorean, charging up the Flux-capitor, and going back to the 1996. Suddenly your CSS is written with inline style tags, useful CSS properties don't work and you're burried in a sea of table tags.
General rule of thumb: your email is not going to look identical in every client. And that’s OK.
It's not all doom and gloom though, and we're all in this together. Foundation for Emails helps by getting you away from tables (Sass version), helping you with an organized project structure, and a well tested codebase to make this much easier. We've put together this guide and [links to resources](http://foundation.zurb.com/emails/resources.html) from our friends to help you along as well as a new [Responsive Emails master class](http://zurb.com/university/responsive-emails-foundation) to become a HTML email pro.
---
## HTML
#### Email Container Width
The email equivalent of the browser window is the "viewport", or the area in an email client dedicated to showing the actual email. This varies quite a bit.
Foundation for Emails' default container with around 600px wide. That's because the majority of email clients have a preview pane that is around 550-700 pixels. With the Sass version, you can easily customize this width by adjusting the `$global-width` variable.
The height of your email doesn't matter as much because people scroll. It still helps to have your most compelling content towards the top.
#### Structure and alignment:
When it comes to making emails, divs aren’t a thing. Don’t kill the messenger, but it’s true. It's not fun finding out we can't just use a `` with auto left and right margins for centering, or background colors; It won't work most email clients. `
`'s can still be used for targeting CSS and for grouping semantically related elements, but shouldn’t be used for for structural purposes or spacing.
Instead, you can use the `
` Inky tag to create background colors and target elements inside. [More on Wrapper →](wrapper.html)
Use tables instead. For those of you who haven’t used tables since Netscape Navigator (or ever) here’s a quick recap.
There are three main tags in a table.
```html
```
The `` tag wraps the entire table. The `` tag denotes a row. The `` tag is used to wrap a table cell.
Some web browsers may be forgiving, but it’s important to include all three tags. Don’t get lazy and skip the ` |
`. Email clients can be unpredictable, so the first step to good rendering is to have valid markup.
*It makes debugging and sharing code a lot easier when you’re consistent. It lets other developers get oriented within the code and makes it easier to tell what you’re looking at, just like consistent indentation and comments.*
While semantic, the “table row” and “table data” elements aren’t that helpful for creating row and column layouts. They’re designed for spreadsheets or other *non-uniform* grids. They can’t be used structurally.
Instead, we use nested tables. Think a bunch of single-cell spreadsheets being nested.
Where we would have divs in website land…
```html
```
…we have tables in email world.
```html
```
Table elements have their own special “display” values. Sometimes we can override them to display as block elements, but more on that later. The display value (in combination with the HTML schema specified in the DOCTYPE), specifies the rules for rendering each element.
Tables have all sorts of fancy HTML attributes…not all of which can be set in CSS. This is unfortunate because separation of concerns dictates that we should try and keep our structure in the markup (HTML) and styles in the CSS. Some inliners will take care of this for you.
```html
```
Speaking of CSS, you should only set classes and IDs on tables or `` tags, not ` |
` tags. If you need to apply padding, only do that on a `` as well. Been there, done that — we had a lot of trouble with this while building the first version of Foundation for Emails. Your milage may vary, but just trying to help you out by saving you some time.
---
## CSS
#### CSS Support
Support of CSS properties varies greatly between email clients. You're best off sticking with the basics and not getting too fancy.
This CSS compatibility chart will really save you some pain when writing CSS:
[CSS Support Chart](https://www.campaignmonitor.com/css/b/)
For some things you can do and work-arounds, see the Progressive Enhancement section below.
---
#### Inlining CSS
Gmail strips the `` (and, consequently, ` |