I'm creating responsive emails that turn two-column layouts into stacked one-column emails when viewed on a phone. The process works fine but requires some code massaging to make desktop-based Outlook 2010 happy. This page explains the process and the steps one must take in order to please Outlook 2010. The fix works great.
http://www.emailonacid.com/blog/details/C13/removing_unwanted_spacing_or_gaps_between_tables_in_outlook_2007_2010
...except when the email is very long. Once the first column of content reaches a certain length, Outlook stops placing the second column beside it and instead throws it well down the layout, to the point that it will create a large gutter under the first column of content and a huge blank header above the right column. The code below, as simple as it is, will duplicate this behavior if you open it in IE and choose File/Send page by email. You can make the rendering problem go away by deleting a few of the X's, whihc points to a ling length limit or some crazy "I'm looking for a page break" behavior by the Word rendering engine. I rknow that the Word rendering engine sucks, but I want to know a guideline stating when this problem will happen, because at this point most of the problems with the Word engine have been documented, and are fairly consistent. My problem is that most people know to send short emails, so the don't have this issue. I work with groups that love quantity.
If anyone knows how to avoid this or knows the specific trigger characteristics, let me know. FYI, you can replace the br's with p's or rows and the problem is the same. Obviously, the emails I send out are much more complex than this, but that was the point with this code, to show how simple things can be while still producing the problem.
<table width="100" border="0" cellsbracing="0" cellbradding="0" valign="top">
<tr></tr>
<tr>
<td align="left" valign="top"><table align="left">
<tr>
<td align="left" valign="tobr">
X<br>X<br>X<br>X<br>X<br>X<br>X<br>
X<br>X<br>X<br>X<br>X<br>X<br>X<br>
X<br>X<br>X<br>X<br>X<br>X<br>X<br>
X<br>X<br>X<br>X<br>X<br>X<br>X<br>
X<br>X<br>X<br>X<br>X<br>X<br>X<br>
X<br>X<br>X<br>X<br>X<br>X<br>X<br>
X<br>X<br>X<br>X<br>X<br>X<br>X<br>
X<br>X<br>X<br>X<br>X<br>X<br>X<br>
X<br>X<br>X<br>X<br>X<br>X<br>X<br>
X<br>X<br>X<br>X<br>X<br>X<br>X<br>
X<br>X<br>X<br>X<br>X<br>X<br>X<br>
X<br>X<br>X<br>X<br>X<br>X<br>X<br>
X<br>X<br>X<br>X<br>X<br>X<br>X<br>
X<br>X<br>X<br>X<br>X<br>X<br>X<br>
X<br></td>
</tr>
</table>
<table align="left">
<tr>
<td align="left" valign="top">O<br>
O<br>O<br>O<br>O<br>O<br>O<br>O
<br>O<br>O<br>O<br>O<br>O<br>O
<br>O<br>O<br>O<br>O<br>O</td>
</tr>
</table></td>
</tr>
</table>
Blimey, check me out necro'ing a month old question.
I don't want to sound pedantic or patronising, and i don't know if this is actually the code you've used to replicate the problem or you've simply rewritten it to post here - but little errors that a browser can interpret correctly go horribly wrong when interpreted by an email client.
so, just to clarify little errors like spelling mistakes, namely things like this :
<cellbradding>
and there's a good few elements missing their end tags.
it might be worth your while to run the emails through the w3c validator as transitional, simply to pick out them kind of errors, or an any IDE that supports HTML.
i know the only times i've had crazy rendering issues with emails was when they didnt know how to interpret something crazy i'd written.
Related
Working on an email blast and for the life of me I cannot get the text to center in mobile view. The URL is: http://strictpixel.com/clients/relevant/fbc/email/
I am referencing the top navigation, under the logo. In mobile, it slides to the left and I am not sure why.
I know this is something simple but I have been pulling my hair out for an hour.
Thanks!
Yeah that really is a mess and you should consider refactoring. There's no way you need all those nested tables.
However, if you plan to keep it this way, the problem is likely stemming from your HTML being invalid. First, the <center> tag is dead and should not be used. Second, you break the flow of your table structure beginning after the comment I inserted below:
<p class="template-label">469-952-6404</p></td>
<td class="expander"></td>
</tr>
</table>
</td>
<!-- You can't start the new table below here without first either
opening a new <td> or closing the <tr> and <table> that is open!! -->
<table class="container">
<tr>
<td class="wrapper">
<table class="twelve columns" style="background-color:#f1f5f8;vertical-align:center;">
...
My best guess is that you missed opening up the next <td> tag just before that table begins.
Use an online HTML validator to help you find where your table structure is broken. Something like http://www.freeformatter.com/html-validator.html may prove useful.
I've been trying to figure out if its possible for me to set an automatic reply that sends out an HTML formatted email. I need this to send out a fancy looking "We'll get back to you shortly" with images and links. I have the HTML code with me (with all headers and inline CSS), but I have no way to format the body of the email response as HTML.
Any ideas on how I can get this done?
I'm using Outlook Web App.
Thanks
You can use a library like swiftmailer http://swiftmailer.org/
Open up your text editor and get ready to start using tables. You're going to want to start out with something like this.
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<table width="650" cellpadding="0" cellspacing="0" border="0">
<tr>
<!-- the amount of td you need -->
</tr>
</table>
</td>
</tr>
</table>
Of course you'll need to figure out the exact layout, but expect to do a lot of table nesting. There are also issues between different email clients concerning how it all renders. Make sure if you're making an empty table cell used for spacing, make sure to do something like this.
<td style="height: 10px; font-size: 0; line-height: 0;">&nsbp;</td>
Otherwise you'll get unexpected spaces in things like Outlook.
Campaign monitor has a lot of useful tips about building out emails, check it out here.
I'm messing around with the aesthetics of a site I'm building and have been left scratching my head on something that looks like it should be simple, or so I thought.
I am using a table to place the content of my the site into, and when I run it through my local host (Using XAMP) the scale of table <td> tags is how I want it, but when I host it through my godaddy account the <td>s in my main content <tr> are scaled differently (seems to be influenced by the header row).
Here's the link to my current page and you'll see the problem. (BTW the site is not finished so any spelling mistakes and stuff like that feel free to ignore :))
http://www.sittingducksfc.co.uk/
So how would I go about creating evenly sized <td>'s within that row? as you can see the furthest right <td> is squashed to the same scale as the loginbox at the top. I have been fiddling with it for a while but I'm probably missing some simple css but I haven't found any previous question with the same problem.
Regards
Mike
So the problem appears to by your stylesheet... You have the three <td> which all have the width of 33%
I am using Google Chrome 31.0.1650.63m and it shows up fine but other browsers may not, i would suggest to do the following change
<td colspan="1" style="background-color:white;text-align:center;width: 30%;height:30%;">
I would also suggest using a stylesheet as opposed to editing the style in-line
Hi all thanks for your responses.
From trail and error i have gone for a different approach and stacked multiple tables into my main div and that allows me to specify the particular widths of each td within that particular table.
From further investigation it can also be seen
here and i apologize for a repeat question.
Here is my example code.
<div>
<table width="100%" height="100%" border="0" cellspacing="10" cellpadding="10">
<tr>
<td width="80%"></td>
<td width="20%"></td>
</tr>
</table>
<table width="100%" height="100%" border="0" cellspacing="10" cellpadding="10">
<tr>
<td width="33%"></td>
<td width="34%"></td>
<td width="33%"></td>
</tr>
</table>
</div>
This can be stacked many times without each table affecting the other.
Im coding html newsletter and faced up with strange thing in gmail. Code:
<table cellpadding="0" cellspacing="0" width="700" height="122">
<tr>
<td valign="top" colspan="3" width="689" height="8"><img src="http://www.url.com/img/product_top_border.gif"></td>
</tr>
<tr>
<td valign="top" width="12" height="106"><img src="http://www.url.com/img/product_left_border.gif"></td>
<td valign="top" height="106" width="689">
some content
</td>
<td valign="top" width="12" height="106"><img src="http://www.url.com/img/product_right_border.gif"></td>
</tr>
<tr>
<td valign="top" colspan="3" width="689" height="8"><img src="http://www.url.com/img/product_bot_border.gif"></td>
</tr>
</table>
Gmail screenshot:
Screenshot from other email clients:
Any hints?
Your help would be appreciated.
It's a browser issue. When you put an image inside a table, the image should be an inline element, sitting on a text line. That means there will be space below it (for parts of a line of text that go below the baseline, ie. descenders) and GMail's rendering is ‘correct’.
However, in Quirks mode, as well as “almost standards” mode, an image that is alone in a cell behaves like a block instead of an inline element, so it doesn't get the extra spacing. It looks like the ‘other’ client is in Quirks mode, as it has reset the font size inside the table (a typical Quirks mode bug).
Normally you want to avoid Quirks mode at all costs, so you'd use Standards mode and fix up the img-in-table problem by setting CSS display: block or vertical-align:-anything-but-baseline on the <img> elements, or, better, dump the ugly layout-table and use some background images instead. However of course in a e-mail context your opportunities for styling are strictly limited.
So yeah, try setting style="display: block" on the images to try to make them display the same in Quirks vs Standards if you like, but be aware that this is the least of your problems when dealing with HTML mail. You will face much, much worse breakages than that. HTML e-mail completely sucks on every level; if you have any chance to get out of it, by just mailing a link to a proper web page, then do that.
In regard to the change of fonts, it somewhat seems like the 'other client' might show a non-HTML body and I think gmail supports HTML by default.
Have you set the content-data to be HTML?
For instance in c# you might need to set:
MailMessage mail = new MailMessage();
mail.IsBodyHtml = true;
I've got a bit of a complicated set up. I specialise in XSLT which I write for 3rd party system. All CSS looks fine in the browser. Now that system provides a button that converts my generated HTML into MS Word 2003.
However, table borders don't convert as they appear in a Browser. There are lots of tables and they have different borders setup. For example there is one that uses only outside border and no borders inside it. When converting to MS Word, a table appears with ALL the borders in between cells. Which I don't want.
I've tried search the Internet, but didn't come across anything useful. Maybe there are tips or tricks on how to set up tables borders so it's understood properly by MS Word.
The third party said the following: "The system just passes the HTML created through the converter it finds in the installed version of Word".
I would really appreciate any tips and help!
Here is what you need:
<table border=1 cellspacing=0 cellpadding=0
style='border-collapse:collapse;border:none;mso-border-alt:solid windowtext .5pt;'>
...
</table>
I was trying to get a table with only the outer border and no inside ones. I've been trying the following HTML:
<table border="1" frame="border" rules="none" cellpadding="4" cellspacing="0">
However, in the Word that table appears with both outer and inner borders, not just with outer border as I was trying to get it.
Well, that is what border does. Hmm. You say inline CSS doesn't get picked up, so I guess both this:
<table style="border: 1px black solid" ....>
or surrounding the table with a <div>
<div style="border: 1px black solid"><table .....></table></div>
won't work? Those would be the most elegant solutions.
If all that fails, why not put the table into a table?
<table border="1" bordercolor="black" cellspacing="0" cellpadding="0">
<tr><td>
<table .... Your table ........> </table>
</td></tr>
</table>
it's a horrible practice to use in 2010 from a web design point of view, but if it's the only workaround so you can import the page correctly, maybe it's necessary. I'm pretty sure however that some form of CSS must work. Maybe a different notation or something. But I'm no Word HTML expert.
Perhaps if you setup the tables how you would like it in word and then export this as an html file. Then import this back into word to see it works correctly. Then apply the style structure from your html file to your CSS/HTML generation system.