Developing Emails for Cross-Browser, Cross-Client Compatibility: Part II
In Part I of this tutorial, I went through the steps of slicing the email within Photoshop before beginning the development. In this tutorial, I will go through the steps of modifying the exported HTML for text expandability and proper rendering in the majority of email clients.
Let's Get Started!
First, Open up your HTML file within your code editor of choice. I will be using Dreamweaver CS5, but other good options are Komodo Edit and Espresso (30 day free trial).
Here are the initial steps you should take care of:
- Add the doctype to the top of your html file
- Remove entire meta tag row within the header
- Set the background color on your body tag and remove leftmargin, topmargin, marginwidth, and marginheight if present
- Place the subject line between the title tags
- Remove the id (if present) and height from the table tag
• Secondly, since the meta tag is being ignored, it becomes unecessary code that the server and email client has to read. Removing the meta tag (and any other unnecessary HTML) will reduce the size of the email, increase the speed in which it is delivered, rendered within the email client, and received by your client.
Now we can start coding our email to be expandable and replacing image text with live text. When I refer to live text, I am referring to using web-safe fonts and text in replacement of an image that contains text that can be converted this way. Slices that contain graphics, photos, or illustrative fonts cannot be replaced with live text.
The screenshot below details which slices will be converted to live text:
Converting to Live Text in Action:
- Combine the <td> tag and the <img> tag by removing the src and alt from the img tag, but keeping the width and height.
- Add the background color of the slice to your new td tag:
- Insert your text in between the td tags.
- Style the live text as accurately to the creative as possible.
- Do the same with the remaining live text slices, changing the font sizes where appropriate.
<td colspan="4"><img src="images/08.gif" width="570" height="35" alt="" /></td>
will become
<td colspan="4" width="570" height="35"></td>
| HTML Font Size | CSS Pixel Font-Size |
| 1 | 10, 11 |
| 2 | 13 |
| 3 | 15 |
| 4 | 17, 18 |
| 5 | 22 |
| 6 | 26 |
<td bgcolor="#3d4852" colspan="4" width="570" height="35" align="center"><font face="Verdana, Geneva, sans-serif" size="1" style="font-size:10px; color:#8d9ca4">You are receiving this email because ______________<br />Having trouble reading this email? View it in your browser. Click here to unsubscribe.</font></td>
Expandability in Action:
In order to account for different email clients rendering text, line-heights, fonts, sizes, etc. differently, you have to make the areas around your live text expandable. To do this, you convert your image to a background color. Obviously this won't work for images that contain graphics, but more on that below.
- Go through each td tag on the left and right side of your email that has the dark grey background color. Ignore the slices that contain the blue ribbon for now. Convert each image to the background color, as we did for the live text areas, keeping the height and width of each.
- Now, go to the images with the blue ribbon that are next to your live text. The way we will make these slices expandable to the live text is we will ADD a background color to the td tag, but not remove the image. We are also going to align the image to the bottom so that if the text grows, the blue ribbon will be pushed down to follow the email. If this happens, the background color we have added to the td cell will also grow, preventing breaking.
<tr>
<td bgcolor="#3d4852" valign="bottom">
<img src="images/11.gif" width="115" height="58" alt="" /></td>
<td bgcolor="#eaf4f7" valign="bottom">
<img src="images/12.gif" width="18" height="58" alt="" /></td>
<td colspan="3" bgcolor="#eaf4f7" width="552" height="58"><font face="Verdana, Geneva, sans-serif" size="5" style="font-size:27px;" color="#3994b5">A collection of textile samples</font></td>
<td bgcolor="#3d4852" width="115" height="58"></td>
</tr>
This is how your email will look if additional text is added and your email needs to expand. You can also see how if a different email client renders a font size slightly different, you won't be stuck with a white line break through your email, the ribbon would be pushed slightly down instead with the correct background colors.
