HTML email formatted to display in Outlook - word spacing issue - html

I've been attempting to format an email template to work cross-client. I've tried different frameworks and I've read about compatibility issues, especially with Outlook. Although I've been able to format the template to display pretty well in Outlook, I'm still having an issue where there are large spaces between words. It does not happen in every paragraph and it seems to only happen with one or two words at a time. I've taken this screenshot for reference. Notice the disclaimer text under the 'Chocolate World' section.
Here is the code for that section, all styles are inline. Is there a compatibility issue with any of the inline styles that might be causing this issue?
<table align="left" cellpadding="0" cellspacing="0" class="deviceWidth" style="width: 33%;">
<tbody>
<tr>
<td style="padding: 0 10px 20px 10px;" align="center" valign="top">
<p style="mso-table-lspace: 0; mso-table-rspace: 0; margin: 0;"><img align="left" alt="" border="0" class="deviceWidth" src="http://www.ctsciencecenter.org/cm_mailer/impact/chocolate-world-expo_impaCT.jpg" style=" width: 128px;padding:0px 0px 0px 10px;" width="128" /></p>
</td>
</tr>
<tr>
<td style="padding: 0 10px 20px 10px;"><a style="text-decoration: none; font-size: 16px; color: #333; font-weight: bold; font-family: Arial, sans-serif;" href="#">Chocolate World Expo</a>
<p style="color: #333; text-align: left; font-size: 12px; line-height: 24px;"><strong>April 27, 10AM–7PM<br />
Special Member Pricing:<br />
$15 Adults, $10 Youth<br />
Coupon Code: Bonbon</strong></p>
<p style="color: #333; text-align: left; font-size: 12px; line-height: 24px;">Sample chocolate offerings, baked goods, cheeses and gelato that will perk up your taste buds. Enjoy a different treat with every step. All of these delicious items will be available for purchase! Visit Chocolate World Expo on the web to find what you fancy.<br /><br /><strong style="font-size:11px;">Please note that we will be CLOSED to the public on April 27. Purchasing tickets in advance is highly recommended.</strong></p>
<table align="left" style="width: 90px;">
<tbody>
<tr>
<td style="padding: 10px 16px; background-color: #666; border-top: 1px solid #eee; background-repeat: repeat-x;" align="center" bgcolor="#666"><a style="color: #FFF; font-size: 12px; font-weight: bold; text-align: center; text-decoration: none; font-family: Arial, sans-serif; -webkit-text-size-adjust: none;">Tickets » </a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
Thank you for your help!

I'm not sure where your CSS is that is causing the text to justify (do you have it in your head <style>?), but it looks as though you are trying to prevent it happening locally as you are using text-align:left;.
text-align doesn't always work - in html email, you should instead use align="left" in your <td> element. This will affect all within it.
Example:
<table width="600" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left">
This text will align left
</td>
</tr>
</table>

Full text justification in narrow block of HTML is never going to look good. This has nothing to do with your styling, but rather the limitations of the text justification algorithm.
Since it cannot break-words and use hyphens to wrap (as you'll see in properly typeset magazines and books) you often end up with this exact problem. It's best to avoid full-justification unless you have much wider columns.

You could try using a soft hyphen:
­ or ­
Words which are to long to fit in a column, are broken in to two using a dash.
This dash can be placed in every part of the sentence and will only show, if the word breaks at that soft hyphen.
Se this example:
a­very­long­word­will­break­when­a­soft­hyphen­is­added­at­the­right­spot­and­adds­a­dash­to­break­the­word­at­the­next­row­without­adding­too­much­dashes
a­very­long­word­will­break­when­a­soft­hyphen­is­added­at­the­right­spot­and­adds­a­dash­to­break­the­word­at­the­next­row­without­adding­too­much­dashes

Did you try add a align left and vertical align top to the td and set the width and height?
Replace all the td for
<td align="left" valign="top" width="value-image" height="value-image" > </td>
Also, you must to set up a display: block for any image
<img style="display:block;" height="value-image" width="value-image">
I hope to be helpful

Related

Button Text Alignment in Outlook.com

Finding a strange behavior only in outlook.com with a button text alignment for an email build. For some reason it's aligned to the top of the button instead of being in the middle. Unable to figure out why this is. Any insights appreciated.
Thank you for your time and thoughts.
Code snippet and CTA image link below.
<table cellpadding="0" cellspacing="0" border="0" >
<tr>
<td style="padding: 0px 0px 0px 0px; background-color:#989b98; font-family:Arial, Helvetica, sans-serif; font-size:16px; color:#e4008f; cursor: pointer; display: block; min-height: 45px; vertical-align: middle; min-width: 220px;" align="center" valign="middle">16pxXXXX XXXXX XXXXX</td>
</tr>
</table>
I would first start off by reviewing this asset for anything "email" related in order to get an understanding of how different email clients react with CSS.
You will notice how display is not supported in Outlook which would result in your anchor tag not being able to use padding. I would recommend coding an email button the following way:
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td align="center" valign="middle" bgcolor="#989b98" style="padding: 12px 20px; font-family: 'Arial', Helvetica, sans-serif; font-size: 16px; font-weight: bold;">
16pxXXXX XXXXX XXXXX
</td>
</tr>
</tbody>
</table>
This unfortunately only makes the text clickable and not the entire button, but it's going to be your best option in order to make it consistent across all other email clients without having to create an image.

HTML Horizontal Line HR

I created an hr line but when I view it on other browsers, the color I set for it doesn't retain and it defaults to a grey color. Is there another code I could use to create a line? I also need to create two lines to be stacked on top of each other. Thanks!
Here's the code!
<tr>
<td><table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td style="padding: 30px 0 0; font-family: Century gothic; font-weight: bold; text-align: center; mso-height-rule: exactly; color: #4F2C1D"><span style="font-size: 40px;">FIRSTNAME LASTNAME</span><br><span style="font-size: 20px; color: #4F2C1D">(415) 333-3333<br>john.doe#gmail.com</span>
<br><br><hr width="60%" size="8" align="center" color="B7DD79"><br>
</td>
</tr>
</table></td>
</tr>
<hr> layout attributes are removed in HTML5, possibly the browser it's "working" on allows you to use the outdated version. Try using a CSS file to style it instead.
source
It's hard to answer with no code provided.
Firstly try adding
hr {
clear: both;
}
to the css to clear floating elements.
Secondly you could always make an empty div with a border bottom which should work?

Copyright, Registered Trademark, Trademark, and Servicemark Entity Positioning

Does anybody know why the © and ® don't superscript nicely without affecting the leading (i.e. line-height) like ™ and ℠ do?
I've tried wrapping © and ® with <sup> and even <small> but I can't get it to work the way I need it to. Sometimes changing the font size helps but not always.
This is for HTML emails where we use it in <h1>, subheads, and body copy.
When I do wrap it in <sup> and apply CSS it just becomes difficult to control. It behaves differently from one email client to another, and one device to another (this is for responsive emails).
Here's the fiddle: http://jsfiddle.net/cy03eov1/5/
And of course position: and em don't work well in email and margin support is spotty.
body {
font-size: 26px;
line-height: 1em;
color: #ccc;
font-family: Helvetica, sans-serif;
background: lightslategray;
}
table {
width: 80%;
margin: 30px auto 0;
background: #fff;
padding: 5px 20px;
}
.copyright {
font-size:70%;
}
<table cellspacing="0" border="0">
<tr>
<td>
<p>Do you know that horrible fear when you’ve broken something on a client project and you have no idea how to fix it? I do… Sometimes I’ll have been<span class="copyright" style="color:red;"><sup>©</sup></span> wading through templates on a site, getting it all up to scratch, then suddenly I’m faced with a page of doom—a whole<span style="color:red; font-size: 70%; vertical-align:text-top;">®</span> page of garbled semi-English that sort of resembles an error<span style="color:red;">™</span> message, but nothing I’ve ever seen before.</p>
<p>As a freelancer, I’ve always been proud to have the time to dedicate to learning<span style="color:red;">℠</span>. Keeping up with the industry, and being able to level up my skills on each new project, is very important to me.</p>
<p>But sometimes I struggled when I pushed myself that little bit too far. A few times I’ve had to request a lifeline from kind people on Twitter to pull me out of a hole. And then I feel a bit daft, having to admit my inadequacies on a social network in order to save myself from a worse situation.</p>
</td>
</tr>
</table>
Unicode does not have superscript or subscript glyphs for these characters so you have to modify the font style separately
http://jsfiddle.net/cy03eov1/8/embedded/result/
I just added
p span { }
and made the font smaller and moved it up by 8 pixels.
I noticed you mentioned your doing this for an email. While the above mentioned solution would work fine for a webpage, it's best not to use CSS in email, especially positioning attributes like position:relative;
You can achieve the same affect with tables though (see demo)
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="20" style="font-size:18px;">Line of text followed by a </td>
<td height="20">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="10" style="font-size:9px;">©</td>
</tr>
<tr>
<td height="10"><table border="0" cellpadding="0" cellspacing="0"><tr><td><table border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr></table></td></tr></table></td><!-- this is a standard table spacer alternative to email shim -->
</tr>
</table>
</td>
<td height="20" style="font-size:18px;">character.</td>
</tr>
</table>
Takes a lot more work but works across all email clients.

Hotmail incorrectly "stretching" HTML/CSS signature

I've been working on making a signature (CSS+HTML) work across multiple platforms, and have hit the wall when it comes to Hotmail.
For some reason, when sending this signature to my Hotmail address, it gets stretched vertically. It seems that Hotmail, for one reason or another, is adding a lot of white space below the text in each table cell?
The problem is clearly illustrated in this graphic: http://www.madculture.es/images/test.jpg
The first signature there, is the intended output. I added borders on #2, to better highlight the problem. Signature three is how it looks when received in Hotmail! :(
This signature works fine in Outlook 2003-2013, Gmail, Lotus Notes, but not in Hotmail.
Does anyone know what could be the reason? I'm clueless, having experimented with this for days now.
Here's the full code for the signature:
<div>
<table border="1" cellspacing="0" cellpadding="1" height="50" style="font-family: Verdana, Arial, sans-serif; font-size: 1em;">
<tr>
<td rowspan="4">
<img src="mc2.png" nosend="1" width="170" height="86" />
</td>
<td style="padding-top: 2px;">
John D. Doe
</td>
</tr>
<tr>
<td style="font-size: 0.85em; font-weight: bold; color: #932D1F; padding-bottom: 2px;">
Marketing & analytics
</td>
</tr>
<tr>
<td style="display: block;">
johnd#doe.com
</td>
</tr>
<tr>
<td style="font-size: 1.05em; font-weight: bold; color: #444; padding-top: 1px;">
Madrid
</td>
</tr>
</table>
</div>
I hope someone can help...
Try slowly removing elements and re-testing at every stage. As a start:
Your table has a height set that's less than your main image
Use nested tables, not rowspan for better email client support
Avoid padding and use set heights instead
Don't set your td to display: block
Add font styling directly to td s (not the table) to get Outlook working correctly

Are there other whitespace codes like &nbsp for half-spaces, em-spaces, en-spaces etc useful in HTML?

Wondering if there are other codes available to use in an HTML newsletter.
I would use cell padding or margins but I'm new to this HTML/CSS thing and I can't find a change that does effect both the Main Title line and the sub-head under it. Being an email I'm hesitant to go mucking around with the CSS to get it just so — since I don't know what email clients don't like in the way of CSS as opposed to inline markup.
For context the template I'm using is Mute theme from Mailchimp snip:
<!-- language: lang-html -->
<table cellspacing="0" cellpadding="0" border="0" align="center" width="626">
<tbody>
<tr>
<td valign="middle" bgcolor="#546781" height="97" background="images/header-bg.jpg" style="vertical-align: middle;">
<table cellspacing="0" cellpadding="0" border="0" align="center" width="555" height="97">
<tbody>
<tr>
<td valign="middle" width="160" style="vertical-align:middle; text-align: left;">
<img width="70" height="70" src="http://dl.dropbox.com/…….png" style="margin:0; margin-top: 4px; display: block;" alt="" />
</td>
<td valign="middle" style="vertical-align: middle; text-align: left;">
<h1 class="title" style="margin:0; padding:0; font-size:30px; font-weight: normal; color: #192c45 !important;">
<singleline label="Title"><span>Title of Report</span></singleline>
</h1>
<h1 class="title" style="margin:0; padding:0; font-size:15px; font-weight: normal; color: #192c45 !important;">
<singleline label="Title"><span>Small Subhead</span></singleline>
</h1>
</td>
<td width="55" valign="middle" style="vertical-align:middle; text-align: center;">
<h2 class="date" style="margin:0; padding:0; font-size:13px; font-weight: normal; color: #192c45 !important; text-transform: uppercase; font-weight: bold; line-height:1;">
<currentmonthname />December
</h2>
<h2 class="date" style="margin:0; padding:0; font-size:23px; font-weight: normal; color: #192c45 !important; font-weight: bold;">
<currentyear />2011
</h2>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
The whole email as a web page can be seen here
Yes, many.
Including, but not limited to:
[ ] hair space :   or &hairsp;
[ ] 6-per-em space :   (no character reference available)
[ ] narrow no-break space :   (no character reference available)
[ ] thin space :   or  
[ ] 4-per-em space :   or &emsp14;
[ ] non breaking space :   or
[ ] punctuation space :   or &puncsp; 
[ ] 3-per-em space :   or &emsp13;
[ ] en space :   or  
[ ] figure space :   or &numsp; 
[ ] em space :   or  
span{background-color: red;}
<table>
<tr><td>non breaking space:</td><td> <span> </span> or <span> </span></td></tr>
<tr><td>narrow no-break space:</td><td> <span> </span></td></tr>
<tr><td>en space:</td><td> <span> </span> or <span> </span></td></tr>
<tr><td>em space:</td><td> <span> </span> or <span> </span></td></tr>
<tr><td>3-per-em space:</td><td> <span> </span> or <span>&emsp13;</span></td></tr>
<tr><td>4-per-em space:</td><td> <span> </span> or <span>&emsp14;</span></td></tr>
<tr><td>6-per-em space:</td><td> <span> </span></td></tr>
<tr><td>figure space:</td><td> <span> </span> or <span>&numsp;</span></td></tr>
<tr><td>punctuation space:</td><td> <span> </span> or <span>&puncsp;</span></td></tr>
<tr><td>thin space:</td><td> <span> </span> or <span> </span></td></tr>
<tr><td>hair space:</td><td> <span> </span> or <span>&hairsp;</span></td></tr>
</table>
There are codes for other space characters, and the codes as such work well, but the characters themselves are legacy character. They have been included into character sets only due to their presence in existing character data, rather than for use in new documents. For some combinations of font and browser version, they may cause a generic glyph of unrepresentable character to be shown. For details, check my page about Unicode spaces.
So using CSS is safer and lets you specify any desired amount of spacing, not just the specific widths of fixed-width spaces. If you just want to have added spacing around your h2 elements, as it seems to me, then setting padding on those elements (changing the value of the padding: 0 settings that you already have) should work fine.
Not sure if this is what you're referring to, but this is the list of HTML entities you can use:
List of XML and HTML character entity references
Using the content within the 'Name' column you can just wrap these in an & and ;
E.g.
,  , etc.
What about normal encoded white-space character?
I used this Unicode Decimal Code ‌ and worked. more details