Blog


Repurpose your Images for Mobile Email

10.19.2011

Read More Design Emails for Mobile Devices

Get connected with Email on Acid for up-to-date news and information on the subject of email design, development, and testing!

Email Testing RSS Feed Email Test on Twitter Email Preview on Digg Email CSS on Linked In Email Simulator on Stumbled Upon

Email Testing RSS Feed Email Test on Twitter Email Preview on Digg Email CSS on Linked In Email Simulator on Stumbled Upon

By Michelle Klann
May 16, 2011
 
 
 

Spacing Issues in Outlook 2007 and 2010

In some instances, Outlook 2007 and 2010 will render an unwanted horizontal space in your email. We've been aware of this for a while and figured it's time we hunker down in search for an explanation. If you are running into this issue, hopefully this article will provide you with some useful work-a-rounds.

We'd like to offer a special thanks to Adam Naisbitt from EasyBlast.co.uk for helping us troubleshoot and collaborate on possible fixes. Thanks Adam, it's people like you who keep our developer community going strong!

The Cause

As we all know, Outlook 2007 and 2010 use the Microsoft Word rendering engine for displaying HTML emails. The desktop application of MS Word allows you to choose from a few different layout views but Outlook uses the "Web Layout" view which is much like a WYSIWYG editor because it outputs its own HTML code. Within its viewer, it uses "text boundaries" which differ slightly from "page breaks." When Word interprets a page break, it actually inserts a <BR /> tag in its HTML output. Text boundaries are used to separate elements within the web layout for purposes of printing and don't actually output any HTML code.

From our research, we learned that text boundaries stretch to a maximum height of 23.7 inches (aprox. 1,790 pixels) before it automatically inserts a partition line and creates a new text boundary. Therefore, If you have any tables that are higher than 23.7 inches within your email, it will get broken up into multiple, stacked text boundaries.

Most often the contents from one text boundary to the next is flush and therefore unnoticeable. However, when you do find unwanted spacing, you might be in for lots of fine tuning before you get it resolved.

Automatically generated text boundaries always render at the same height so if you have a table with a width of 100% of the view pane and your content flows accordingly, the location of the actual partition line will be dependent on the size of the viewer's window. Also, I was primarily testing with Outlook 2007, part of Microsoft Office Enterprise 2007. The maximum height of text boundaries may vary from one version of Microsoft Office to the next.

From what I can tell, there is no way to disable or increase the maximum height for text boundaries. In fact, I was really hoping to find a document specific property in the HTML output because that might have led way a possible hack. In all of the documentation I have found, even from Microsoft, they imply that the maximum document size is a hard, fast rule and there is no getting around it.

Here are some instances that might cause the spacing:

1.) A table with two or more columns that stretch longer than 23.7 inches in height.


(click on the image above to view the entire email)

2.) Nested tables within a large containing table.

3.) Tables that are reliant on rowspans that exceed 23.7 inches in height.

4.) A large image that is placed at or around the 23.7 inch border might get bumped up or down from one text boundary to the next causing lots of unwanted spacing. In fact, I also tested images that where larger than 23.7 inches and the Word viewer essentially resizes the image to a proportion that fits within the text boundary. So if you insert really tall spacer gif, for example, it will get placed into one of the text boundaries and will be resized within that boundary's height constraint.

There may be several other instances that cause the gap, if you come across one that hasn't been listed here, please let us know about it, we'd be happy to look at your HTML code.

So what is the solution?

Generally speaking, I recommend testing your email first to see if text boundaries are causing spaces. As I mentioned, many times the table looks fluid, no matter how many nested tables you may have. If you do see a space, here are some things you can try:

1.) The best solution is to break out your tables into two (or more) stacked tables that are less than 23.7 inches in height. A new text boundary is created every time you create a new table element so one table might be 10 inches and another might be 15 inches. As long as each individual table does not exceed the height constraint you won't end up with automatically generated text boundaries.

Use nested tables within each stacked table but be aware of the fact that some of your nested tables might be over 23.7 inches in height. With that said, you could start breaking those apart first and test between each iteration.

When doing this, you might have to remove all spaces and carriage returns within your code, particularly between your closing and opening tables. This helps to ensure that they stack on top of each other perfectly.

Since this may cause a complete restructure of your table layout, it's a good idea to get in the habit of designing your tables so that they can be easily stackable when needed. You might only have to break apart one table that exceeds the maximum height, others might not cause a noticeable gap.

If you are using a wrapper table to control the background color of your email try using a span with "display:block" instead. Click here for an explanation on that.

2.) Try setting a break right BEFORE the spacing, using style="page-break-before: always".

For example, if the issue is right on a certain table row, then make that <tr> into:

<tr style="page-break-before: always">

A big thanks to MiketheCoder for this recommendation! Here's the full article: Outlook 2007 Screws up spacing where page breaks would appear


3.) Add a "height" attribute in the TD that is getting broken. Sometimes this can limit the amount of spacing.

<td height="2000">

4.) You can try inserting breaks or paragraph tags strategically in order to match up each column of your table so the text boundary appears seamless. 

<p style="height:10px; margin-bottom:0; margin-top:0; padding:0">&nbsp</p>

It is important to break out margin-bottom and margin-top here because Hotmail does not support the generic "margin" property. Since this can be tricky and your content is bound to change, this option is less ideal.

5.) You can try adding content to the section above the forced break to push the content down and avoid the break - but this is also not ideal as you might not be in charge of the content within the email.

I have read from other blogs and resources to avoid using more than 3 nested tables in Outlook 2007 and 2010 but I have yet to prove this theory. Many times, if you remove nested tables, you are actually removing a table that exceeds 23.7 inches so this might be why it has worked for others in the past. Again, if you have more examples or information to share, don't hesitate to reach out to us and shed your wisdom on the subject.

If you have gotten in the habit of inserting wrapper tables with a width of 100% for purposes of adding a background color, this might cause your table to be over 23.7 inches. I wrote a follow up article on ways to achieve the same effect in every email client without having to use a wrapper table: Background Colors in HTML Emails.

Comments

WOW - at little past midnight last night I found this article and it saved me from the depths of depression trying to figure out - why ow why is this happening on a big campaign I was sending out this morning - ALL NOW SORTED - YOU ARE A SUPERSTAR! Many thanks!
By Chris Peak on 05/25/2011

You may (or may not) wish to rewrite your introduction... The problem you describe is not "unwanted horizontal space" imo but rather "unwanted vertical space". The gaps may well appear as horizontal shapes, but the breaks are appearing in the vertical flow of the document.

I am actually looking for a solution to unwanted horizontal space between sibling tables (in Outlook 2007) this article got my hopes up momentarily... before dashing them rather disappointingly. It does sound like a rather mad issue you describe (typical of Microsoft), thankfully I've never had to create an email over 23.7 inches high.. :S
By Phil Glanville on 06/01/2011

Thank you for detailing this! I've been wracking my brain trying to figure out what was going on in Outlook 2010 -- this article and another on MikeTheCoder's web site helped substantially. What a ridiculous thing to happen in emails meant to be displayed on SCREEN! Thanks yet again Microsoft for your inane and maddening software and browser bugs.
By Nathaniel on 06/09/2011

I found an easy fix. Publish the email as a web page. Copy the web page into an email that you send yourself. Then use the source code of that email. Don't even try to decipher the HTML that Microsoft creates. I'll give you a headache. (Note to Microsoft if anyone there reads this: Why the heck would you use Word to render HTML when Internet Explorer is most certainly installed on the same machine? Can't you leave page breaks to printer drivers?)
By Scott See on 11/24/2011

Thanks a ton, this has been driving me crazy...
By Ceb on 11/24/2011

Inches! Seriously?
By lewismc on 11/30/2011

So glad I found this too. Its also been driving me nuts.
By Richard Lalchan on 12/05/2011

Thanks for this tip - I was pulling my hair out the whole day until I saw this tip. My images had spaces between them.

Nice work.
By Helen Neely on 12/06/2011

I nearly cried when I found this. Thank you.
By Victoria Martinez on 12/16/2011

@Scott, you are right, but it can go deeper than that. If they actually wrote Internet Explorer properly and modularly they could use the same rendering engine without even worrying about if any dependencies are installed.

But if Microsoft was really thinking, they'd just fork the Webkit code and use that instead of making a square wheel when we already have a plethora of round templates available!
By T on 12/20/2011

We are also having the same unwanted space issue.Can you please review my code?
By Gandhimathy S on 01/19/2012

I have a tall image 688 x 3776 pixels.

Whenever I try to Insert the picture in the email body, Outlook automatically resizes it to about 56% of its size. This image is a snapshot of a webpage, hence due to the resizing the text in the image is not readable.

Is there a way to insert and maintain the original proportions of the image in Outlook 2007?
By Sam on 03/13/2012

Sam,

Not that I know of, if I where you, I would try slicing that image to three images with a max height of 1790px each. Then stack them on top of each other. You might have to use two separate tables to do so.
By Michelle Klann on 03/13/2012

@Michelle Klann
Thanks for your solution, it worked, though i find it to be a crude one. Is that the only way to go about it, I mean I have longer pictures to email some streching to 10,000px, do I keep on cutting them. Is there no roundabout to this problem, a solution which would let us insert a picture of any size and retain its original dimensions.

Sam
By Sam on 03/16/2012

Another Tip. Vertical padding on <td> or <tr> will cause horizontal white space between your rows. use
for vertical padding
By developer_autumn01 on 04/30/2012

Share Your Comment

Name:
Email:
Location:
URL:

Comment:

Remember my personal information
Notify me of follow-up comments?

Please enter the word you see in the image below:



Share/Save/Bookmark

If you haven't signed up yet, give our FREE online Email Test a try. Just drop in your code and we will instantly simulate your email in the most popular email clients!

Get connected with Email on Acid for up-to-date news and information on the subject of email design, development, and testing!

Email Testing RSS Feed Email Test on Twitter Email Preview on Digg Email CSS on Linked In Email Simulator on Stumbled Upon

Follow us on Twitter Become a Friend on Facebook Subscribe to our Blog Digg Us! Recommend on StumbleUpon