Windows Outlook defaults HTML font to Times New Roman - html

My html/css codes render correctly in Mac Outlook but Windows Outlook overrides fonts to Times New Roman. Below is the code to the email. Can someone let me know what am I missing?
<style style="-ms-text-size-adjust: 100%;">
html, body {
margin: 0 auto;
padding: 0;
height: 100%;
width: 100%;
}
* {
-ms-text-size-adjust: 100%;
}
table, td {
mso-table-lspace: 0pt;
mso-table-rspace: 0pt;
}
img {
-ms-interpolation-mode:bicubic;
}
a {
text-decoration: none;
}
</style>
<!--[if !mso]>
<style type=”text/css”>
body, table, td {font-family: Arial, Helvetica, sans-serif !important;}
</style>
<![endif]-->
</head>
<body bgcolor="#fff" style="font-family: 'Open Sans', sans-serif;margin-top: 0;margin-right: auto;margin-bottom: 0;margin-left: auto;-ms-text-size-adjust: 100%;height: 100%;width: 100%;" align="center">
<table border="0" cellpadding="0" cellspacing="0" style="table-layout: fixed;display: block;width: 640px;margin-top: 0;margin-right:auto;margin-bottom: 0;margin-left: auto;padding-right: 20px; padding-left: 20px; -ms-text-size-adjust: 100%;mso-table-lspace: 0pt;mso-table-rspace: 0pt;" align="center">

you've got an error in the conditional code where you're trying to target Outlook.
Rather than <!--[if !mso]>, it should be <!--[if mso]>.
With <!--[if !mso]>, you're saying 'if NOT mso'.

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 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;}

How do you make text aligned with the cell below it with css?

I'm designing an email and I'm not sure how to make text aligned with the rows below it. I want the "Our Weather Experts" and "ARE LOOKING OUT FOR YOU." to stretch across the table and be flush with the rows below it that includes the paragraph and learn more button. I tried using letter spacing and different sorts of padding, but is this even possible?
It's supposed to look like this:
I also tried to get the "Our Weather Experts" line to be skinny text, but the font-weight: lighter attribute doesn't seem to be working either.
Any help would be appreciated.
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<style type="text/css">
.borderbottom {border-bottom: 1px solid #dadada;}
.innerpadding {padding: 30px 30px 30px 30px;}
/* CLIENT-SPECIFIC STYLES */
#outlook a{padding:0;} /* Force Outlook to provide a "view in browser" message */
.ReadMsgBody{width:100%;} .ExternalClass{width:100%;} /* Force Hotmail to display emails at full width */
.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} /* Force Hotmail to display normal line spacing */
body, table, td, a{-webkit-text-size-adjust:100%; -ms-text-size-adjust:100%;} /* Prevent WebKit and Windows mobile changing default text sizes */
table, td{mso-table-lspace:0pt; mso-table-rspace:0pt;} /* Remove spacing between tables in Outlook 2007 and up */
img{-ms-interpolation-mode:bicubic;} /* Allow smoother rendering of resized image in Internet Explorer */
/* RESET STYLES */
body{margin:0; padding:0;}
img{border:0; height:auto; line-height:100%; outline:none; text-decoration:none;}
table{border-collapse:collapse !important;}
body{height:100% !important; margin:0; padding:0; width:100% !important;}
/* iOS BLUE LINKS */
.appleBody a {color:#68440a; text-decoration: none;}
.appleFooter a {color:#999999; text-decoration: none;}
</style>
</head>
<body yahoo="fix" style="margin: 0; padding: 0; ">
<table class="container" width="640" align="center" cellpadding="0" cellspacing="0" border="0" style="margin: 0 auto; padding: 0;">
<tr>
<td valign="top" align="center" bgcolor="#ffffff">
<div class="mobile-only" style="text-indent: -99999em; display: none; height: 0; width: 0; overflow: hidden; max-height: 0;">
<img src="http://image.email-libertymutual.com/lib/fe6a15707464047f7c1c/m/1/CatAuto-Header-Mobile-320x159.jpgg" border="0">
</div>
<div class="no-mobile">
<img src="http://image.email-libertymutual.com/lib/fe6a15707464047f7c1c/m/1/CatAuto-Header-Desktop-640x220.jpg" border="0">
</div>
</td>
</tr>
<tr>
<td valign="top" align="center" bgcolor="#ffffff" style="padding:30px;" >
<table cellpadding="0" cellspacing="0" border="0" width="600">
<tr>
<td colspan="2" style="letter-spacing: 3px; font-family: Arial, Helvetica, sans-serif; font-size:43px; color: #002663">
OUR WEATHER EXPERTS
</td>
</tr>
<tr>
<td colspan="2" style="letter-spacing: 3px; font-family: Arial, Helvetica, sans-serif; font-size:36px; color: #002663">
<strong>ARE LOOKING OUT FOR YOU.</strong>
</td>
</tr>
<tr>
<td style="font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#666666; line-height:20px; padding:20px 35px 25px 0px;" align="left" class="borderbottom">
Your area is likely to receive severe storms in the upcoming months. We've prepared information and tips to help protect you and your loved ones this season.
</td>
<td style="font-family: Arial, Helvetica, sans-serif; vertical-align:top; padding: 20px 0px 30px 0px"; align="left" class="borderbottom">
<img src="http://image.email-libertymutual.com/lib/fe6a15707464047f7c1c/m/1/CatAuto-Button-Learn-More-139x38.jpg" style="display:block;" width="139" height="38">
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
What you want to do is
text-align:justify;
but with only one line of text it gets a bit messy.
You need to add an empty container with a width of 100% to push the text to the end.
<span style="display:inline-block;width:100%;"></span>
Then it will add extra space below the text so you need to adjust the line-heights.
See fiddle https://jsfiddle.net/y7vp8oz0/

Newsletter border error

I was try to create a responsive email template.everything work fine,except image border.
I set border for an image and media styles.but in small screen,image border will be crpped.
HTML
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<style type="text/css">
#media only screen and (max-width: 480px) {
.message_mobile {
width: 100% !important;
}
}
</style>
</head>
<body id="message_body" style="background-color:white;" >
<table style="border: 0px; border-collapse: collapse; border-spacing: 0px; width: 600px; display: table;" align="center" class="message_mobile"><tbody><tr>
<td align="left" valign="top">
<table cellpadding="0" cellspacing="0" style="border: 0px; border-collapse: collapse; border-spacing: 0px; width: 100%; overflow: hidden;">
<tbody><tr>
<td style="vertical-align:top;text-align:center;">
<div>
<img src="http://www.myfico.com/Images/sample_overlay.gif" alt=" " style="border: 16px solid rgb(196, 45, 196); display: block; width: 100%; padding: 2px; max-width: 94.64882943143813%;" width="auto">
</div>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody>
</table>
</body>
</html>
Output (Large screen)
Output (Small Screen)
Fiddle Demo
You could set box-sizing to border-box, however since this is a relatively new property, not all browsers (especially email clients) may support it.