I have an email template with different block background colors, and because of this the colors are bleeding and creating lines between the blocks
I tried all the solutions I found and nothing worked, and after hours of digging I think the problem is that the nested tables are slightly shorter than their parent tables
here you can see the problem and what I mean by slightly shorter (the orange is showing and the white is within it, if it was the same height no orange will be showing):
and this is the code for one of the blocks:
<div>
<table
align="center"
border="0"
cellpadding="0"
cellspacing="0"
style="margin: 0; padding: 0; background:{$cordial-variable}; border-collapse: collapse;"
bgcolor="{$cordial-variable}"
width="100%"
>
<tr>
<td align="center" valign="top">
<table
width="700"
bgcolor="#fcfcfc"
border="0"
cellspacing="0"
cellpadding="0"
style="
mso-table-rspace: 0pt;
mso-table-lspace: 0pt;
border-collapse: collapse;
border: 0;
width: 100%;
height: auto;
padding: 0;
"
>
<tr>
<td align="center" valign="top">
<div>
<table
width="600"
border="0"
cellspacing="0"
cellpadding="0"
style="
mso-table-rspace: 0pt;
mso-table-lspace: 0pt;
border-collapse: collapse;
border: 0;
padding: 0;
width: 80%;
height: auto;
"
>
<tr>
<td style="35px" height="35"></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
the things I tried: setting background color for all tables and tds, setting valign for all trs, changing the heights to even values instead of odd ones, setting the images with 0 line-height and font-size, setting the height to 100% instead of auto.
Any further suggestions?
To get a block a specific height, cross email compatible, you need only this:
<tr>
<td style="padding:35px 0 0 0;font-size:0;line-height: 0;"> </td>
</tr>
Note the which you don't have--some email clients will add that in and then use a default font-size or line-height on it.
The first <table> you have is fine: cellpadding, cellspacing and border are zeroed and that should be enough.
<div>s are not needed.
Related
I have been digging all over and experimenting with different attributes, but I am still no closer to getting Outlook (v2005) to respect <td> cell height. I have a simple table being used through Gravity forms in Wordpress which is handling all the overhead. The <td> is set o have the mso-line-height-rule line height and font size as mentioned several times elsewhere, but comes out as below.
<table border="0" cellpadding="0" cellspacing="0" width="80px" width="80" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt;">
<tbody>
<tr>
<td style="background-color: red; height: 30px; font-size: 30px; mso-line-height-rule: exactly; line-height: 30px; padding: 0 !important; margin: 0 !important;" height="30">
Hello
</td>
</tr>
<tbody>
</table>
If anyone could help it would be greatly appreciated.
Screenshot of Outlook version:
I've tried creating an email signature but whenever I paste it into outlook the padding for the bottom of the logo gets removed? I also tried adding margin instead but it still got deleted? The only way is to add a space in manually after, but I'm sure this is not a good practice?
Thanks
<div>
<td style="vertical-align: top;">
<table cellspacing="0" cellpadding="0" border="0" role="presentation" style="font-size: 0px;">
<tbody>
<tr>
<td style="vertical-align: top;"><div style="margin-right: 10px; width: 150px; border-radius: 0px; padding-bottom: 10px;">
<img src="https://s3.eu-central-1.amazonaws.com/mysigmail/upload/2019-04-29-hzc85zi6onw.png" alt="avatar" style="width: 150px; border-radius: 0px;">
</div>
Apply the padding to the parent td cell instead of the div
<table cellspacing="0" cellpadding="0" border="0" role="presentation">
<tr>
<td style="padding: 0 0 10px 0;">
** content **
</td>
</tr>
</table>
As a heads up:
Outlook 2013-2019 do not work with padding-top
apply the image width to the image. Outlook will ignore the width in style
border-radius does not work with Outlook
Good luck.
I have created a custom email template and the content is below :
...
<table id="Table_01" width="70%" border="0" cellpadding="0" cellspacing="0" style=" backgroud:red;border-collapse: collapse;border-spacing: 0;">
<tr>
<td valign="top">
<img style="display:block; border: 0px;width:100%;" src="images/01.png" alt="">
</td>
</tr>
<tr>
<td valign="top">
<table id="Table_02" width="100%" border="0" cellpadding="0" cellspacing="0" style=" border-collapse: collapse;border-spacing: 0;">
<tr>
<td>
<img style="display:block; border: 0px;width:100%;" src="images/02_01.png" alt="">
</td>
<td >
<img style="display:block; border: 0px;width:100%;" src="images/02_03.png" alt="">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<img style="display:block; border: 0px;width:100%;" src="images/03.png" alt="">
</td>
</tr>
</table>
...
Above code created a table with three tr and it is showing properly in desktop but in mobile devices showing some spacing.
As above image table showing red line spacing in mobile devices.
How to remove these spacing?
**It helps to include a few CSS resets in the <head> of the email.**Here are a few that I use the focus on resetting spacing and borders of <table>s and <td>s:
<head>
<style>
/* What it does: Fixes webkit padding issue. Fix for Yahoo mail table alignment bug. Applies table-layout to the first 2 tables then removes for anything nested deeper. */
table {
border-spacing: 0 !important;
border-collapse: collapse !important;
table-layout: fixed !important;
margin: 0 auto !important;
}
table table table {
table-layout: auto;
}
/* What it does: Stops Outlook from adding extra spacing to tables. */
table,
td {
mso-table-lspace: 0pt !important;
mso-table-rspace: 0pt !important;
}
</style>
</head>
Here is the full CSS reset I use for emails.
Content in a responsive email template needs to appear centred in Thunderbird. The template involves a couple of tables nested inside a main table. Content centers in one of the tables, but not in the others and I can't understand why. Here's what it looks like:
<style>
body {
height: 100%;
width: 100%;
}
.bodycontainer{
max-width: 600px;
padding: 15px 5px 15px 5px;
display:block;
line-height: 140%;
color: #34282C;
}
</style>
<body>
<table width="100%" style="table-layout: fixed; margin: 0 auto;">
<tr>
<td align="center">
<table align="center" border="0" cellpadding="0" cellspacing="0"
style="padding: 5px 0; font-family: Helvetica, Arial, sans-serif;
font-size: 11px; color: #2e5a67; width: auto !important;
table-layout: fixed; margin: 0 auto;">
<tr>
<!-- This content will center -->
<td align="center"><a target="_blank" href=""
style="font-family: Helvetica, Arial, sans-serif;
font-size: 10px; color: #999; text-decoration: none;">
This content will center</a>
</td>
</tr>
</table>
<table class="bodyContainer" cellspacing="0" border="0"
align="center" width="600" style="max-width: 600px; table-layout:
fixed; margin: 0 auto;">
<tr>
<!-- This content WILL NOT center -->
<td align="center" style="padding:15px 0px 15px;"><a href="">
<img width="125" src=""
alt="This image will NOT center" border="0"></a></td>
</tr>
</table>
<table class="bodyContainer" cellspacing="0" border="0"
align="center" width="600" style="padding-top: 15px;
max-width: 600px; table-layout: fixed; margin: 0 auto;">
<tr>
<!-- This content will center -->
<td class="" align="center" style="padding:10px 0 20px;">
<a href=""
target="_blank"><img src=""
alt="This image will center" width="80"
border="0"></a></td>
</tr>
</table>
</td>
</tr>
</table>
The issue is the "Display:Block" in your head stylesheet. Display block will force the element to be a block element. Block elements width is based on the child content's size and also defaults to a sort of 'float:left' and there is no easy way to overwrite this. Your best bet is to remove this from the stylesheet.
If you need to include display:block inside your email template(e.g. sliced images, background colors, etc), I would use it sparingly and keep in mind that the element you place it on will be changed as stated above.
New to coding and i can not for the life of me see why this email is not working in outlook 2010, it's just the top part as well, any advise on how to fix this or
<table>
<tr>
<td valign="top" width="15px"> </td>
<td width="50">
<img alt="" height="99" src="http://www.uploadlibrary.com/first4families/TCM-Test/cell_03.png" width="123" /></td>
<td align="right" valign="top" width="585"></td>
</tr>
</table>
<table bgcolor="#5BBBB7" cellpadding="0" cellspacing="0" style="width: 600px">
<tr>
<td height="340px" width="600px">
<table align="center" cellpadding="0" cellspacing="0" style="width: 574px">
<tr>
<td colspan="3" style="height: 32px; width: 574px">
<img alt="" height="32" height="32px" src="http://www.uploadlibrary.com/first4families/TCM-Test/cell_07.png" width="574" /></td>
</tr>
<tr>
<td rowspan="2" style="height: 279px; width: 13px">
<img alt="" height="279" src="http://www.uploadlibrary.com/first4families/TCM-Test/cell_09.png" width="13" /></td>
<td align="left" bgcolor="#ffffff" style="padding-top: 10px; padding-left: 10px; padding-right: 10px" style="display: block; font-family: Tahoma, Verdana, Segoe, sans-serif; font-size: 12px; color: #000000; line-height: 14px; height: 212px;" valign="top" width="218px">
</td>
<td rowspan="2" style="height: 279px; width: 343px">
<img alt="" height="279" src="http://www.uploadlibrary.com/first4families/TCM-Test/cell_11.png" width="343" /></td>
</tr>
<tr>
<td style="height: 67px; width: 218px">
<img alt="" height="67" src="http://www.uploadlibrary.com/first4families/TCM-Test/cell_12.png" style="display: block" width="218" /></td>
</tr>
</table>
I don't think Outlook accepts height / width CSS, so stick to the HTML attributes instead.
Also- take the px off of your html attributes, that should solve a chunk of it.
Set display:block on all your images too, and if I remember correctly Outlook isn't great at rowspan - try and separate your tables rather than trying to have rows with different amounts of columns.