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 mklann
April 4, 2011
 
 
 

CSS Padding in Outlook 2007 and 2010

For those of you who design and develop HTML emails for Outlook 2007 and 2010, you already know that you are bound by tables and you have very limited CSS support. What you might not realize is that these two email clients convert your code from something legible into a seemingly foreign Microsoft language.

One of the more critical conversions that you should be aware of is that Outlook 2007 and 2010 will often move your CSS from div's and headings into nested paragraph and spans. Sometimes, it keeps the outer container, other times it eliminates it entirely.

For example this:

<h2 style="font-size: 15px; font-weight: bold; margin: 0; padding: 17px 0 0 0;">
  NEW FASHIONS
</h2>

<div style="font-size: 15px; font-weight: bold; margin: 0; padding: 17px 0 0 0;">
  NEW FASHIONS
</div>

<p style="font-size: 15px; font-weight: bold; margin: 0; padding: 17px 0 0 0;">
  NEW FASHIONS
</p>

Will get converted to:

<style>
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}

h2
{mso-style-priority:9;
mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-link:"Heading 2 Char";
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
mso-outline-level:2;
font-size:18.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}

p
{mso-style-noshow:yes;
mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;}
</style>

<h2 style='margin:0in;margin-bottom:.0001pt'>
   <span style='font-size:11.5pt; mso-fareast-font-family:"Times New Roman"'>
       NEW FASHIONS
       <o:p></o:p>
    </span>
</h2>

<div>
   <p class=MsoNormal>
     <b>
     <span style='font-size:11.5pt;mso-fareast-font-family:"Times New Roman"'>
       NEW FASHIONS
       <o:p></o:p>
     </span>
   </b>
   </p>
</div>

<p style='margin:0in;margin-bottom:.0001pt'>
   <b>
     <span style='font-size:11.5pt'>
       NEW FASHIONS
       <o:p></o:p>
     </span>
   </b>
</p>

The Problem

As you can see, this conversion moved our CSS from its original box element container to an inline SPAN element and the padding was ignored.

Solutions

One work-around is to avoid padding in block element containers and use margins instead.

<h2 style="font-size: 15px; font-weight: bold; margin-left: 5px; margin-right: 5px; margin-bottom: 5px;">
  NEW FASHIONS
</h2>

Note: I did not include the "margin" nor "margin-top" properties in this example because they are not supported by Hotmail.

After extensive testing, we have confirmed that the padding property is supported in TD's. So another fix is to move your padding into the containing TD, for example:

<td style="padding: 17px 0 0 0">
   <h2 style="font-size: 15px; font-weight: bold; margin: 0">NEW FASHIONS</h2>
</td>

Comments

Great Post! I was not aware of it, I am using outlook 2007 and happpy to find information on CSS padding here. Thanks for sharing the useful post.
By Flash Website Templates on 05/31/2011

thanks! useful!
By burberry scarf on 11/25/2011

Thanks for your post. I was trying to figure out why certain HTML element padding properties are being ignored exclusively on 2007 and 2010.

I ended up returning back to my simple full table formatting for padding, instead of defining padding for a particular td, I define a containing table and empty cells with spacer images for exact pixels padding effect. But this information did allow me to take my email templates to a more updated approach. and I will be quoting this post in my blog.
By Jonathan Wong on 02/14/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