HTML email column width changing with different email clients - html

I could not find a direct answer for this, so please be patient if this has been asked before.
I have limited HTML experience. The width of the table columns within the email change when opened in Entourage and Gmail on my Android phone. Gmail on my PC looks fine, Outlook, Yahoo, etc. also great.
Essentially what happens is the widths of the left and right column switch in Entourage/Gmail-droid. Left column width should stay at width="401"; right column should stay fixed at width="171" (they swap so the left column is 171 and the right is 401).
I am working with an HTML email template I picked up online with nested tables. Here is the basic code with text and images stripped out. Any help would be appreciated:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css" media="screen">
html {
-webkit-text-size-adjust:none;
-webkit-background-size:100%;
}
.bold {
color: #61BB46;
}
.Main {
font-family: Verdana, Helvetica, sans-serif;
font-size: 12px;
line-height: 22px;
color: #666666;
}
.Sidebar {
font-family: Verdana, Helvetica, sans-serif;
font-size: 12px;
line-height: 22px;
color: #666666;
}
a:link {
COLOR: #592989;
}
a:visited {
COLOR: #FAAB53;
}
a:hover {
COLOR: #61BB46;
}
a:active {
COLOR: #592989;
}
</style>
<body bgcolor="#ffffff" text="#666666" style="padding:0px; margin:0px;">
<table style="font-family: Verdana, Helvetica, sans-serif; color: #666666;
font-size: 12px; Line-height: 18px; width: 600px;" border="0" cellspacing="0"
cellpadding="0" align="center">
<tr>
<td style="font-size: 30px; line-height: 32px; color: #592989;" colspan="4">
<div style="font-size: 12px; color:#999;"></div></td>
</tr>
<tr>
<td style="padding-top: 20px;" colspan="4"><table border="0" cellspacing="0"
cellpadding="0" align="center">
<tbody>
<tr>
<td style="padding: 4px; background-color: #e3dede;"><img src=""
width="578" height="190"></td>
</tr>
</tbody>
</table></td>
</tr>
<tr>
<td style="padding-top: 20px; padding-bottom: 20px; text-align: left;"
colspan="4"><p><a href="" target="_blank">
</td>
</tr>
<tr>
<td rowspan="5" width="401" valign="top"><p style="color: #592989;
font-size: 20px;"></p>
<p class="Main" style="margin-bottom: 1.0em">
</p></td>
<td rowspan="5" width="19" valign="top"> </td>
<td style="background-color: #592989; padding: 4px; padding-left: 8px;
color: #ffffff; font-size: 14px;" width="171" valign="top"><p></p></td>
<tr>
</table>
</body>

First rule with sending HTML email use inline styles. Many clients will strip out any styles in the <head> tag. The safest bet is to not even bother with a <head> or <body> tag as most of the time these get stripped out. Validate your html. You have some invalid markup that many clients will strip out:
<td style="padding-top: 20px;" colspan="4"><table border="0" cellspacing="0"
cellpadding="0" align="center">
<tbody>
Should be:
<td style="padding-top: 20px;" colspan="4"><table border="0" cellspacing="0"
cellpadding="0" align="center">
<table>
<tbody>

Related

How to position elements in HTML

I am completely new to HTML. I am working on creating a template for emails in Action Network, however, I can not figure out how to position the elements I created. I would like the donate button to be in the middle and all of the social media links to be on the right, underneath the logo at the top. When I try to move the logos to the right, they end up being in the white area instead of underneath the logo. ANY help is appreciated. The code is below:
#outlook a {
padding: 0;
}
.ExternalClass {
width: 100%;
}
.ExternalClass,
.ExternalClass p,
.ExternalClass span,
.ExternalClass font,
.ExternalClass td,
.ExternalClass div {
line-height: 100%;
}
img {
outline: none;
text-decoration: none;
-ms-interpolation-mode: bicubic;
}
a img {
border: none;
}
.image_fix {
display: block;
}
p {
margin: 1em 0;
}
h1,
h2,
h3,
h4,
h5,
h6 {
color: #404040
}
table td {
border-collapse: collapse;
}
#media only screen and (max-device-width: 480px) {
a[href^="tel"],
a[href^="sms"] {
text-decoration: none;
color: blue;
cursor: default;
}
.mobile_link a[href^="tel"],
.mobile_link a[href^="sms"] {
text-decoration: default;
color: orange;
pointer-events: auto;
cursor: default;
}
}
#media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
a[href^="tel"],
a[href^="sms"] {
text-decoration: none;
color: blue;
cursor: default;
}
.mobile_link a[href^="tel"],
.mobile_link a[href^="sms"] {
text-decoration: default;
color: orange;
pointer-events: auto;
cursor: default;
}
}
#media only screen and (-webkit-min-device-pixel-ratio: 2) {}
#media only screen and (-webkit-device-pixel-ratio:.75) {}
#media only screen and (-webkit-device-pixel-ratio:1) {}
#media only screen and (-webkit-device-pixel-ratio:1.5) {}
<body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0" style="margin: 0;padding: 0;background-color: #FFFFFF;width: 100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%;">
<center>
<table cellpadding="0" cellspacing="0" border="0" align="center" id="backgroundTable" style="margin: 0;padding: 0;background-color: #FFFFFF;height: 100% !important;width: 100% !important; line-height: 100% !important; border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;"
role="presentation">
<tr>
<td align="center" valign="top" style="border-collapse: collapse;">
<table border="0" cellpadding="0" cellspacing="0" align="center" style="border: 0;background-color: #FFFFFF; border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;" role="presentation">
<tr>
<td align="center" valign="top" style="border-collapse: collapse;">
<table border="0" cellpadding="10" cellspacing="0" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;" role="presentation">
<tr>
<td valign="top" style="border-collapse: collapse; background-color: #FFFFFF; padding:10px 10px 10px;">
<table border="0" cellpadding="10" cellspacing="0" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;" role="presentation">
<tr>
<td valign="top" style="border-collapse: collapse;" width="600">
<div style="color: #383838;font-family: Arial;font-size: 16px;line-height: 150%;text-align: left;">
<center>
<img src="https://can2-prod.s3.amazonaws.com/email_templates/logos/000/029/586/original/centerrrr.png" style="max-width:1492px; width: 100%; margin: 20px auto" />
</center>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<b> DONATE </b>
<br>
<br>
<b><div style="color: #1B4164;font-family: Arial;font-size: 14px;line-height: 125%;text-align: center;"> Center for Community Alternatives</div></b>
<div style="font-family: Arial;font-size: 14px;line-height: 125%;text-align: center;"> communityalternatives.org
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center" valign="top" style="border-collapse: collapse;">
<table border="0" cellpadding="0" cellspacing="0" style="background-color: #FFFFFF;border-top: 2px solid #909090; border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;" role="presentation">
<tr>
<td valign="top" style="border-collapse: collapse;">
<table border="0" cellpadding="10" cellspacing="0" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;" role="presentation">
<tr>
<td colspan="2" valign="middle" style="border-collapse: collapse;background-color: #FFFFFF;border-top: 0;">
<div style="color: #707070;font-family: Arial;font-size: 11px;line-height: 125%;text-align: left;">
Sent via ActionNetwork.org. To update your email address or to stop receiving emails from [your group name], please click here.
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
</center>
</body>
A <table> approach is the right way for HTML email, mostly for Outlook desktop's sake.
You don't need <div>s since you already have a block level element for positioning and styles: the <td>. Put all the styles on the div in the containing <td>.
You can do block-level centering with <center> tag, or the align attribute, and inline/text-level centering with text-align (on the closest block-level parent is best). (Lookup online about block vs inline, it's very important. e.g. https://www.samanthaming.com/pictorials/css-inline-vs-inlineblock-vs-block/)
For ease and consistency, place each row on a new <tr> (table row), and then in the <td> (table data), which always comes inside a row, set your desired padding. (Margins don't work across all email clients.)
Then you can set, e.g. your social media to the right like so:
<tr>
<td align="right">
<!-- Social media icons -->
</td>
</tr>
And your donate button on next line like so:
<tr>
<td align="center">
<!-- Donate button -->
</td>
</tr>
To get them on the same line, use two <td>s in the same row, with desired widths and alignments.
Btw what you have in the <style> part is good. Those reset a few problems in various email clients. Keep researching, but remember HTML email is different because many email clients are pretty backwards.

HTML Emailer border issue

I have created a HTML email and seem to be having issues on some outlooks and mobile outlook with the table cells borders I have attached an image of the issue there seems to be a thin lines where the table cells are.
CSS
html { width: 100%; }
body { -webkit-text-size-adjust: none; -ms-text-size-adjust: none; margin: 0; padding: 0; }
table { border-spacing: 0; border-collapse: collapse; }
table td { border-collapse: collapse; font-family: Arial,sans-serif; line-height:1.4 }
HTML
<table width="600" border="0" cellpadding="0" cellspacing="0" bgcolor="006680" align="center">
<tr>
<td height="10" bgcolor="fd6b0d"></td>
</tr>
</table>
<table width="600" border="0" cellpadding="0" cellspacing="0" bgcolor="006680" align="center">
<tr>
<td width="50" bgcolor="fd6b0d"></td>
<td bgcolor="fd6b0d">
<p style="font-family: Verdana; font-size: 28px; color: #fff; margin: 0; padding: 0; line-height: 60px; text-align: center; font-weight: bold;">
How Confident Are You?
</p>
</td>
<td width="50" bgcolor="fd6b0d"></td>
</tr>
</table>
I thought this was a common issue known as the Outlook Line bug but it isn't.
I couldn't see lines on the desktop versions, but only on the mobiles--because your template is not responsive. So, the Outlook rendering engine is adding an "outlook-overflow-scaling" span wrapper around your tables to compensate.
If you were to make your table responsive (so, for example use width 100%), it would not need to try and scale the email.

HTML Email Padding on TD not rendering - Only for Outlook (Win) 2007, 2010, 2013, 2016

I've been battling literally one final bug fix that only appears in Windows Outlook Desktop, versions 2007, 2010, 2013, and 2016 (plus their respective DPI versions). My left padding keeps getting removed from my td although I use left-padding in other places throughout the email that does not get removed (same class!). I'm hoping you guys can spot something I haven't been able to!
Note: I've stripped out the proprietary stuff and put words in it's place. It's a branding nav bar that contains a varying width image (max width is ~198) and text that should be close (10px padding) away from the image, then a phone # alllll the way to the right
What I have tried:
using padding-left instead of shorthand
applying the padding to the p tag instead
changing p tag from p to span
making all widths percentages
removing all alignment from tds
And one other note - my "strong" class doesn't seem to be applying properly either. Not sure if it's related or not, but figured worth adding.
<style type="text/css">
.padding-l-10 {
padding: 0px 0px 0px 10px !important;
}
.branding {
font-size: 12px !important;
line-height: 18px !important;
}
.phone {
font-size: 12px !important;
}
.branding-bar {
padding: 12px 20px 12px 20px !important;
}
.branding-bar p {
vertical-align: bottom !important;
}
.branding-bar img {
display: block !important;
}
.branding-bar-phone {
font-size: 14px !important;
line-height: 13px !important;
font-weight: 300 !important;
text-align: right !important;
}
.small-text {
font-size: 12px !important;
font-weight: 300 !important;
line-height: 13px !important;
}
.strong {
font-weight: 700!important;
color: #333333;
}
</style>
<table align="center" bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="630">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="branding-bar" align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="590">
<tr>
<td align="left" class="display-block" valign="bottom" width="20%">IMAGE WOULD BE HERE - DYNAMIC WIDTH</td>
<td align="left" class="display-block-relation padding-l-10" valign="bottom" width="40%">
<p class="small-text">
THIS WOULD BE THE TOP WORD
</p>
<p class="small-text strong">
THIS WOULD BE THE BOTTOM WORD
</p>
</td>
<td align="right" class="display-none" valign="bottom" width="40%">
<p class="branding-bar-phone">
THIS WOULD BE A PHONE NUMBER
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>

HTML email signature with variables populated from database

Not sure how to even ask this, but I'm at a stopping point and cannot go further. I am not a programmer and I only dabble in code infrequently, but I would appreciate any help.
Basically, I have written HTML for standardizing an email signature for myself and fellow educators. What I would like to do is create a form (Google Form) that allows them to input the variables such as name, title, email, and phone numbers in the HTML code...then have it spit back the rendered HTML on the same page for them to copy and then paste into the email signature field of their mail client. Not to go in to too much detail, but AD or LDAP distribution is not an option for us right now, so this seems like a solution that may help all parties...if we can get it going.
What I would ideally want is to have the one webpage where let's say the left half of the page is the form and the right side is what renders when they submit.
How can I start to go about this? Here is the static code I have already:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td valign="top" style="padding-left: 0px; padding-top: 0px; padding-bottom:
0px; padding-right: 0px;">
<span style="text-align: left; color: #000000; font-family: Garamond; font-
size: 13pt; font-weight: bold">James McCrary</span><br>
<span style="text-align: left; margin-top: 0px; margin-bottom: 0px; color:
#606060; font-family: Garamond; font-weight: normal; font-size:
10pt;">Academic Technology Coordinator</span><br>
</td>
</tr>
<tr>
<td valign="top" style="padding-left: 0px; padding-top: 0px; padding-bottom:
0px; padding-right: 0px;">
<span style="text-align: left; color: #000000; font-family: Garamond; font-
size: 10pt; font-style: normal; font-weight: normal;">3200 Woodland Ridge
Boulevard <font size="1" color=“#000000”></a>|</font> Baton Rouge, LA
70816<br> Phone: 225-753-3180 ext.1352 <font size="1" color=“#000000”>|
</font> Fax: 225-555-5555<br></span>
</td>
</tr>
<tr>
<td valign="top" style="padding-left: 0px; padding-top: 0px; padding-bottom:
0px; padding-right: 0px;">
<span style="text-align: left; color: #000000; font-family: Garamond; font-
size: 10pt; font-style: normal; font-weight: normal;">E-Mail:
mccraryj#ehsbr.org <font size="1" color=“#000000”>|
</font>www.episcopalbr.org<br></span>
</td>
</tr>
<tr>
<td valign="top" style="padding-left: 0px; padding-top: 7px; padding-bottom:
0px; padding-right: 0px;">
<img src="http://www.episcopalbr.org/uploads/2/9/5/7/29573303/e-mail-
signiture_orig.jpg" nosend="1" border="0" width="148" height=“50”
alt=Episcopal School of Baton Rouge title=“Episcopal School of Baton Rouge”>
</a>
</td>
</tr>
<tr>
<td valign="top" style="padding-left: 8px; padding-top: 7px; padding-bottom:
0px; padding-right: 0px;">
<a href=https://www.facebook.com/episcopalbr/><img
src="http://www.episcopalbr.org/uploads/2/9/5/7/29573303/1468419350.png"
alt=Facebook style="width:28px;height:28px;”></a><a
href=https://www.instagram.com/episcopalbr/><img
src="http://www.episcopalbr.org/uploads/2/9/5/7/29573303/1468419163_1.png"
alt=Instagram style="width:28px;height:28px;"><a
href=https://www.instagram.com/episcopalbr/><img
src="http://www.episcopalbr.org/uploads/2/9/5/7/29573303/1468419163_1.png"
alt=Instagram style="width:28px;height:28px;"><a
href=https://twitter.com/EpiscopalBR><img
src="http://www.episcopalbr.org/uploads/2/9/5/7/29573303/1468419364.png"
alt=Twitter style="width:28px;height:28px;"><a
href=https://www.youtube.com/channel/UC_YRWq4LXw4ON07XoKFhxpA><img
src="http://www.episcopalbr.org/uploads/2/9/5/7/29573303/1468419371.png"
alt=Youtube style="width:28px;height:28px;"><a
href=https://plus.google.com/101907942367473945105/posts><img
src="http://www.episcopalbr.org/uploads/2/9/5/7/29573303/1468419380.png"
alt=Google+ style="width:28px;height:28px;">
</td>
</tr>
</tbody>
</table>
</body>
<style>
a {color: #000000;}
</style>
</html>

HTML Outlook 2013 email exceeding 100% width of panel width width="100%" set

I'm trying to create a responsive HTML email for Outlook 2013 but I'm having trouble trying to get the email to respect the width limit I have set (i.e. width="100%"). The actual width is indeed being set to 100% until I reach a certain smaller width at which point I have to scroll to view the information.
The code works fine in IE (no surprise) so I know the code itself is at least appropriate in that sense (i.e. I haven't wrapped something incorrectly).
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Responsive Email Template</title>
<style type="text/css">
.ReadMsgBody {
width: 100%;
background-color: #ffffff;
}
.ExternalClass {
width: 100%;
background-color: #ffffff;
}
body {
width: 100%;
background-color: #ffffff;
margin:0;
padding:0;
-webkit-font-smoothing: antialiased;
font-family: Georgia, Times, serif
}
table {
border-collapse: collapse;
}
a {
color:#0076b7;
}
.nav-link:visited {
color:#fff;
}
/*
#media only screen and (max-width: 640px) {
.deviceWidth {width:440px!important; padding:0;}
.ReadMsgBody {width:440px!important; padding:0;}
.center {text-align: center!important;}
}
#media only screen and (max-width: 479px) {
.deviceWidth {width:280px!important; padding:0;}
.ReadMsgBody {width:280px!important; padding:0;}
.center {text-align: left!important;}
} */
</style>
</head>
<body style="font-family: Georgia, Times, serif">
<!-- Wrapper -->
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td bgcolor="#fff" style="padding-top:20px" valign="top" width="100%">
<!-- Start Header-->
<table align="center" border="0" cellpadding="0" cellspacing="0" class="deviceWidth" style="font-size:21px; font-weight:bold; margin:0 auto; font-family:'Franklin Gothic',sans-serif;" width="100%">
<tr>
<td bgcolor="#0076B7" width="100%">
<!-- Logo -->
<table align="left" border="0" cellpadding="0" cellspacing="0" class="deviceWidth">
<tr>
<td class="center" style="line-height:32px; padding:5px 20px;">
<a class="nav-link" style="font-size:21px; font-weight:bold; color:#fff; text-decoration: none; font-family:'Franklin Gothic',sans-serif;" href="#">LOGO</a>
</td>
</tr>
</table><!-- End Logo -->
<!-- Nav -->
<table align="right" border="0" cellpadding="0" cellspacing="0" class="deviceWidth">
<tr>
<td class="center" style="font-size: 13px; color: #fff; font-weight: light; text-align: right; font-family:'Franklin Gothic Book',sans-serif; line-height: 24px; vertical-align: middle; padding:10px 20px; font-style:normal">
Home | News | Events | Applications | OrgChart
</td>
</tr>
</table><!-- End Nav -->
</td>
</tr>
</table><!-- End Header -->
<!-- Actual Email Section -->
<table align="center" bgcolor="#fff" border="0" cellpadding="0" cellspacing="0" class="deviceWidth" style="margin:0 auto;" width="100%">
<tr>
<td bgcolor="#fff" style="font-size: 16px; color: #292215; font-weight: normal; text-align: left; font-family: Georgia, Times, serif; line-height: 24px; vertical-align: top; padding:10px 8px 10px 8px">
<table>
<tr>
<td style="padding:10px 10px 10px 0" valign="middle">
Title
</td>
</tr>
</table>
<!-- Content -->
<p>Content here.</p>
</td>
</tr>
<!-- Footer -->
<tr>
<td bgcolor="#fff" style="font-size: 16px; color: #292215; font-weight: normal; text-align: left; font-family: Georgia, Times, serif; line-height: 24px; vertical-align: top; padding:40px 8px 10px 8px">
Place of Work<br>
Jacob Johnson<br>
Work Role<br>
jacobjohnson#me.com<br>
555-555-5555
</td>
</tr>
</table><!-- End One Column -->
</td>
</tr>
</table><!-- End Wrapper -->
<div style="display:none; white-space:nowrap; font:15px courier; color:#ffffff;">
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
</div>
</body>
</html>
Recap: My email extends beyond the width limit I have it set for and I can't figure out why. Outlook is a pain in my butt.
Outlook isn't broken, your code exhibits the same behavior in almost every email client.
The problem is that you set all the tables to have a width of 100%. On many of them, you added the class .deviceWidth, where you specify the width in media queries, but not for anything wider than 640px. Outlook does not support #media queries.
Try adding .deviceWidth {width:440px!important; padding:0;} to your style sheet outside of media queries and address your width="100%" on every table.
JSFiddle is not working for me right now so I can't show you a sample.
Good luck.
Outlook doesn't respect 100% width so you need to set a fixed width for outlook, add width to the wrapper table
<table class="for_others" align="center" border="0"
cellpadding="0" cellspacing="0" width="600">
And using the class set width to 100% for all others. Use !important at the end of the declaration to override inline css.
table.for_others {width: 100% !important;}