Responsive table for Email - html

Trying to get last piece done which is the Email footer area.
There are 4 links in a table, which in web-view are fine, they are in horizontal line.
On Mobile version I'm trying to have them in sets of 2.
Meaning 2 links on top and 2 below them.
The thing is this needs to be done with inline CSS, without having style in it's own separate section.
<table border="0" cellpadding="0" cellspacing="0" id="Table5" width="100%">
<tr style="font-size: 11px; background-color: black;">
<td align="center">
<br>
<br>
<span style="color:#7A7A7A; line-height: 1.3; "><font face="Arial" size="1" ><b>GENERIC INFORMATION 123
<div style="line-height:1.3;">T 000 000 000 |
TEST#TESTING.COM<br></div></b></font></span><br>
<br>
<span style="color: rgb(221, 221, 221);"><font face="Arial" size="1"><b><a alias="" conversion="false" data-linkto="http://" href="google.com" style="color:#999999;text-decoration:none;" title=""><span style="padding:12px;">BOOK APPOINTMENT</span></a><a alias="" conversion="false" data-linkto="http://" href="google.com" style="color:#999999;text-decoration:none;" title=""><span style="padding:12px;">PRIVACY</span></a><a alias="" conversion="false" data-linkto="http://"google.com" style="color:#999999;text-decoration:none;" title=""><span style="padding:12px;">UNSUBSCRIBE</span></a><a alias="" conversion="false" data-linkto="http://" href="google.com" style="color:#999999;text-decoration:none;" title=""><span style="padding:12px;">CONTACT US</span></a></b></font></span><br>
<br>
</td></tr></table>
Any advice? #media is out of the question currently since it cannot be used with inline CSS.

This is the code you need to start. You'll have to do some footwork to get this to not stack in Outlook desktop email clients. It works in every major email client and does not require a #media tag.
The first table always spans the width of email body.
The Left and Right are 300px wide. When the email client is under 300px wide, they will stack.
<table role="presentation" cellspacing="0" cellpadding="0" border="1" width="100%" style="">
<tr>
<td style="font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555; padding: 0 10px 10px; text-align: center;">
<p style="margin: 0;">Single Column</p>
</td>
</tr>
</table>
<table role="presentation" cellspacing="0" cellpadding="0" border="1" width="300" style="float:left;">
<tr>
<td style="font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555; padding: 0 10px 10px; text-align: left;">
<p style="margin: 0;">Left Column</p>
</td>
</tr>
</table>
<table role="presentation" cellspacing="0" cellpadding="0" border="1" width="300" style="float:left;">
<tr>
<td style="font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555; padding: 0 10px 10px; text-align: left;">
<p style="margin: 0;">Right Column</p>
</td>
</tr>
</table>
Good luck.

Related

Outlook 365 Windows Not Respecting Darkmode Media Query - Email Template

For some reason, the text <p> in the footer section of my email template in Outlook 365 Windows is still remaining the color black. This is also happening for the button text too <a> but all other clients are fine when tested.
Here is the media query and footer markup:
#media (prefers-color-scheme: dark) {
body, center, table {
background: #2d2d2d!important;
color: #ffffff!important;
}
.darkmode-footer {
background-color: #7F7CAC!important;
}
.darkmode-social {
background-color: #60C1CB!important;
}
}
<table cellpadding="0" cellspacing="0" border="0" align="center" style="border-spacing: 0px; color: #565656; font-family: 'Lato', sans-serif, Arial, Helvitica!important; background-color: #fafdfe; Margin: 0; padding: 0; width: 100%; max-width: 600px;" role="presentation">
<!-- START FOOTER -->
<tr>
<td style="padding: 0;">
<table cellpadding="0" cellspacing="0" border="0" class="darkmode-footer" width="100%" style="border-spacing: 0; background-color: #7F7CAC;" role="presentation">
<tr>
<td height="8" style="background-color: #21c6b8;"></td>
</tr>
<tr>
<td style="padding: 60px 10px 25px 10px; color: #ffffff; text-align: center; font-size: 16px;">
<p style="font-size: 18px; font-weight: bold; padding: 10px 0 5px 0;">Lorum</p>
<p style="font-size: 16px; padding-bottom: 5px;">Lorum</p>
<p style="font-size: 16px; padding-bottom: 5px;">Lorum</p>
<p style="font-size: 16px; padding-bottom: 5px;">Lorum</p>
<p style="font-size: 16px; padding-bottom: 5px;">Lorum</p>
<p style="font-size: 16px; padding-bottom: 5px;">Lorum</p>
<p style="font-size: 16px; padding-bottom: 5px;">Lorum</p>
<p style="font-size: 16px; padding-bottom: 20px;">Lorum</p>
</td>
</tr>
<tr>
</tr>
<tr>
<td height="8" style="background-color: #21c6b8;"></td>
</tr>
</table>
</td>
</tr>
<!-- END FOOTER -->
</table>
And here is a snippet of the button markup:
<tr>
<td align="left" style="padding-left: 10px;">
<table cellpadding="0" cellspacing="0" border="0" align="left" border="0" style="border-spacing: 0;" role="presentation">
<tr>
<td style="border-radius: 10px;" bgcolor="#60C1CB">
Lorum
</td>
</tr>
</table>
</td>
</tr>
I can add more markup if needed.
Outlook on Windows uses Word’s rendering engine and does not support media queries.
The only possible tweak regarding dark mode in this version of Outlook is to use VML gradients. You can read more about it here: https://webdesign.tutsplus.com/tutorials/how-to-fix-outlook-dark-mode-problems--cms-37718

How to make two tables horizontal on the same like in html

Hello I am trying to make two tables (one with an image) horizontal on the same line. I want it to be so when the screen changes to mobile, the table on the left goes on top of the right one vertically.
<table style="display: inline-block" cellpadding="0" cellspacing="0"
border="0" width="100%">
<tr>
<td align="center" valign="top"
style="background-color: #ffffff; padding-bottom: 0">
<img src="#"
style=" height: auto; display: block; border: 0;">
</td>
</tr>
</table>
<table style="display: inline-block" cellpadding="0" cellspacing="0"
border="0" width="100%">
<tr>
<td align="left" valign="top"
style="background-color: #ffffff; padding-bottom: 0">
<p style="font-size: 16px; line-height:20px; color:#043667; margin:10px 0; font-family: Arial, Narrow, Helvetica, sans-serif">
<span style="color: #9d0059; font-weight: bold">text1,</span> text 2”
<br><span style="color: #9d0059"><i>-HAEGARDA Advocate</i></span>
</p>
</td>
</tr>
</table>
You're on the right track, but you need to get rid of the width:100%, otherwise two of them won't fit side by side in the same line!
Also, I'd use display:inline-table rather than display:inline-block.
table {
display: inline-table;
border-spacing: 0;
border: 0;
}
th,td {
padding: 0
}
<table>
<tr>
<td align="center" valign="top" style="background-color: #ffffff; padding-bottom: 0">
<img src="#" style=" height: auto; display: block; border: 0;">
</td>
</tr>
</table>
<table>
<tr>
<td align="left" valign="top" style="background-color: #ffffff; padding-bottom: 0">
<p style="font-size: 16px; line-height:20px; color:#043667; margin:10px 0; font-family: Arial, Narrow, Helvetica, sans-serif">
<span style="color: #9d0059; font-weight: bold">text1,</span> text 2”
<br><span style="color: #9d0059"><i>-HAEGARDA Advocate</i></span>
</p>
</td>
</tr>
</table>
You can use the flexbox layout to accomplish that. Firstly, you can put both tables inside a div and set the div display property to flex (style="display: flex;"). This will put both tables in-line with each other.
To make them stack vertically on mobile or smaller devices, you can set the div flex-wrap property to wrap. This will cause the tables to stack vertically. Check the code below, most importantly the div tag.
<div style="display: flex; flex-wrap: wrap;">
<table>
<tr>
<td align="center" valign="top" style="background-color: #ffffff; padding-bottom: 0">
<img src="#" style=" height: auto; display: block; border: 0;">
</td>
</tr>
</table>
<table>
<tr>
<td align="left" valign="top" style="background-color: #ffffff; padding-bottom: 0">
<p style="font-size: 16px; line-height:20px; color:#043667; margin:10px 0; font-family: Arial, Narrow, Helvetica, sans-serif">
<span style="color: #9d0059; font-weight: bold">text1,</span> text 2”
<br><span style="color: #9d0059"><i>-HAEGARDA Advocate</i></span>
</p>
</td>
</tr>
</table>
</div>

Colspan Width Issue for Outlook 2013

I'm having trouble getting Outloook 2013 to render this code correctly. I'm trying to get the two columns next to each other in a 600px table in the 2nd row.
For some reason, the first column in the second row is spanning 600px and the second column is correctly to the right but is just tacked on in addition to the 600px so it spans larger than the rest of the columns.
Here is the jsfiddle of the code (sorry for the long code). https://jsfiddle.net/abdiyohan/hdpjjh5x/2/
<body bgcolor="#CCCCCC">
<table align="center" width="100%" height="100%" bgcolor="#CCCCCC" style="background-color:#CCCCCC;">
<tr>
<td width="100%" height="100%" bgcolor="#CCCCCC" style="background-color:#CCCCCC;" align="center">
<table style="width:600px;" cellpadding="0" cellspacing="0" border="0" width="600" bgcolor="#ffffff" align="center">
<tr>
<td colspan="2" style="border-top: 7px solid #a0a5a6; border-bottom: 2px solid #a0a5a6; color: #000000;width:100%;" bgcolor="#005195" height="95" width="100%">
<img align="top" style="font-family:Arial,Helvetica,sans-serif;font-size: 18px;border-style: none;color: #ffffff;" alt="" src="" height="95" width="600" border="0" />
</td>
</tr>
<tr>
<td width="75%" style="border-bottom: 2px solid #a0a5a6;padding:20px 20px 10px 20px;font-family: Arial,Helvetica,sans-serif; color: #e83e2a; width:75%;font-size: 14pt; line-height: 28px;" valign="top" align="left">
<div width="100%" style="width:100%;font-family: Arial,Helvetica,sans-serif; color:#005195;padding-bottom:0px; font-size: 14pt; line-height: 28px;"><a name="English">Lorem Ipsum</a>
<p style="line-height: 20px; margin-bottom: 10px; margin-top: 0px; font-size: 11pt;padding-top:10px;color:#005195;">Lorem Ipsum,</p>
<table cellpadding="0" cellspacing="0" border="0" style="display:block;margin:0px 20px 20px 0;" align="left">
<tr>
<td height="28" style="height:28px;font-family: Arial,Helvetica,sans-serif; font-size: 14px; background:#ccc; border-radius: 5px; padding: 0px 10px; color: #005195;" align="left">
<div align="center"><a style="color: #005195; text-decoration: none;" href="#top" target="_self">Back to Top</a>
</div>
</td>
</tr>
</table>
</div>
</td>
<td colspan="1" style="border-bottom: 2px solid #a0a5a6;background-color:#efefef;padding:20px 20px 0px 20px;font-family: Arial,Helvetica,sans-serif;color:#005195; width:25%; font-size: 14pt; line-height: 28px;" align="right" bgcolor="#ffffff" valign="top" width="25%">
<div style="width:100%;height:100%;" width="100%">
<h1 style="font-size: 14pt;font-family: Arial,Helvetica,sans-serif;color:#005195;font-weight:normal;padding:0px;margin:0px;">Global Links</h1>
<p style="color:#4682B4;font-size: 11pt; line-height: 18px; margin-bottom: 10px;margin-top:10px;"><a style="color:#4682B4; text-decoration: none;" href="#English" target="_self">English</a>
</p>
<p style="color:#4682B4;font-size: 11pt; line-height: 18px; margin-bottom: 10px; margin-top: 20px;"><a style="color:#4682B4; text-decoration: none;" href="#Spanish (Latin America)" target="_self">Español (Latinoamérica)</a>
</p>
</div>
</td>
</tr>
<tr>
<td colspan="2" width="100%" style="border-bottom: 2px solid #a0a5a6;padding:20px 20px 10px 20px;font-family: Arial,Helvetica,sans-serif; color: #e83e2a; width: 100%;font-size: 14pt; line-height: 28px;" valign="top" align="left">
<div width="100%" style="width:100%;font-family: Arial,Helvetica,sans-serif; color:#005195;padding-bottom:0px; font-size: 14pt; line-height: 28px;"> <a name="Spanish (Latin America)"></a>¡Comparta su opinión!
<p style="line-height: 20px; margin-bottom: 10px; margin-top: 0px; font-size: 11pt;padding-top:10px;color:#005195;">Lorem Ipsum,</p>
<table cellpadding="0" cellspacing="0" border="0" style="display:block;margin:0px 20px 20px 0;" align="left">
<tr>
<td height="28" style="height:28px;font-family: Arial,Helvetica,sans-serif; font-size: 14px; background:#ccc; border-radius: 5px; padding: 0px 10px; color: #005195;" align="left">
<div align="center"><a style="color: #005195; text-decoration: none;" href="#top" target="_self">Back to Top</a>
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
I know the code looks pretty messy, but I've tried so many solutions and fixes from across the internet and have come up with nothing.
This code works in OWA, which is strange and depressing, but breaks in Outlook 2013 and Outlook 2011 for Mac. Any help would be much appreciated.
The fact is that Outlook uses Word for rendering HTML markup. You can find the supported and unsupported HTML elements, attributes, and cascading style sheets properties described in the following series of articles in MSDN:
Word 2007 HTML and CSS Rendering Capabilities in Outlook 2007 (Part 1 of 2)
Word 2007 HTML and CSS Rendering Capabilities in Outlook 2007 (Part 2 of 2)

Get two columns (Images Stacked over Text) to sit properly next to each other

This is an error which only occurs in Outlook 2010. This email template seems to work on 90% of devices and browsers.
The graphic below is an example of how it looks in Outlook 2010. The crude blue draw over is intended to show how it should look. You can also view the fiddle for the entire code which displays that section how it is supposed to be displayed.
http://postimg.org/image/zacxr5acr/
Here's the full fiddle link http://jsfiddle.net/Nexus1234/bxp14vcw/
Note - the below sample code is only the relevant section and sending this on its own in an email doesn't cause the issue, it's somewhere within the complete html which is in the jsfiddle
<!-- Two Column (Images Stacked over Text) -->
<table align="center" bgcolor="#EEEEED" border="0" cellpadding="0" cellspacing=
"0" class="deviceWidth" width="580">
<tbody>
<tr>
<td class="center" style="padding:10px 0 0 5px">
<table align="left" border="0" cellpadding="0" cellspacing="0" class=
"deviceWidth" width="49%">
<tbody>
<tr>
<td align="center">
<p style="mso-table-lspace:0;mso-table-rspace:0; margin:0">
<img alt="" class="deviceWidth" src=
"https://mailerdocs.s3.amazonaws.com/i2in/email_assets/108/forum.jpg"
style=
"border-radius: 4px; width: 267px; border-width: 0px; border-style: solid; height: 200px;" /></p>
</td>
</tr>
<tr>
<td style=
"font-size: 12px; color: #6f6f6f; font-weight: normal; text-align: left; font-family: arial,helvetica neue,helvetica,sans-serif; line-height: 24px; vertical-align: top; padding:10px 8px 10px 8px">
<table style="width:100%;border-bottom: 1px solid #333">
<tbody>
<tr>
<td style="padding:0 10px 10px 5px" valign="top">
<img alt="" id="circle" src=
"https://mailerdocs.s3.amazonaws.com/i2in/email_assets/108/point.png"
style=
"border-width: 0px; border-style: solid; float: left; width: 40px; height: 40px;" /></td>
<td style="padding:0 10px 10px 0" valign="middle">
<h1 style=
"text-decoration: none; font-size: 16px; color: #363636; font-weight: bold; font-family:Arial, sans-serif">
The Roman Forum<br />
</h1>
</td>
</tr>
</tbody>
</table>
<p><span style=
"font-family:arial,helvetica neue,helvetica,sans-serif;">Here,
in a small space hemmed in by the great rocks of the Capitoline
and Palatine hills, the greatest names of Roman history fought
for power and prestige. Amidst an extraordinary concentration
of famed and marvellous buildings jostling for space, you will
walk where Antony spoke over Caesar’s body, Cicero
delivered stinging orations and the legions processed in
triumph.</span></p>
</td>
</tr>
</tbody>
</table>
<table align="left" border="0" cellpadding="0" cellspacing="0" class=
"deviceWidth" width="49%">
<tbody>
<tr>
<td align="center">
<p style="mso-table-lspace:0;mso-table-rspace:0; margin:0">
<img alt="" class="deviceWidth" src=
"https://mailerdocs.s3.amazonaws.com/i2in/email_assets/108/villa-deste-tivoli.jpg"
style=
"border-radius: 4px; width: 267px; border-width: 0px; border-style: solid; height: 200px;" /></p>
</td>
</tr>
<tr>
<td style=
"font-size: 12px; color: #6f6f6f; font-weight: normal; text-align: left; font-family: arial,helvetica neue,helvetica,sans-serif; line-height: 24px; vertical-align: top; padding:10px 8px 10px 8px">
<table style="border-bottom: 1px solid #333">
<tbody>
<tr>
<td style="padding:0 10px 10px 5px" valign="top">
<img alt="" id="circle" src=
"https://mailerdocs.s3.amazonaws.com/i2in/email_assets/108/point.png"
style=
"border-width: 0px; border-style: solid; float: left; width: 40px; height: 40px;" /></td>
<td style="padding:0 10px 10px 0" valign="middle">
<h1 style=
"text-decoration: none; font-size: 16px; color: #363636; font-weight: bold; font-family:Arial, sans-serif">
The Villa Adriana & The Villa D'Este</h1>
</td>
</tr>
</tbody>
</table>
<p><span style=
"font-family:arial,helvetica neue,helvetica,sans-serif;">Experience
the opulence of two ages in a trip out to the inspiring
hillside retreat of Tivoli. In the morning, we visit the
massive, brilliantly preserved and sprawling villa of the
Emperor Hadrian, where luxury on an unparalleled scale centres
on a fantasy rendition of the River Nile. The afternoon is
spent amidst the fountains and gardens of the enchanting
Renaissance Villa d’Este.</span></p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table><!-- End Two Column (Images Stacked over Text) -->
One suggestion would be to always keep in mind the 20px rule. Outlook loves to add spacing around tables, making aligned tables a hassle.
My usual equation is,
(Wrapper table - 20px) / 2.
Your example:
(580 - 20px) = 560 / 2.
Percentages are tricky, I would set your tables as a fixed width. Your deviceWidth class will handle your widths on mobile anyway.
I would suggest applying this too all of your aligned tables.
If that doesn't work, let me know.

Swiftmailer removes dot after www inside content

Swiftmailer often removes the . from www. from links inside my mail.
This occurs randomly, I've noticed.
The following often outputs wwwdomain.com, without the . after www
The href url itself is always correct, but not the text link inside of it.
See the <a> tag in the middle:
<!-- START MAIL FOOTER -->
<table width="100%" cellspacing="0" cellpadding="0" align="center" bgcolor="#f6f6f6" style="background: #f6f6f6;">
<tr>
<td valign="top">
<table width="600" cellspacing="0" cellpadding="0" align="center" bgcolor="#f6f6f6" style="background: #f6f6f6;">
<tr>
<td width="5" style="font-size: 1px; line-height: 1px;"> </td>
<td style="font-family: Helvetica, Arial, sans-serif; font-size: 13px; font-weight: 100; color: #8c8c8c; padding: 15px 10px 25px 10px; text-align: center; line-height: 20px; color: #8c8c8c;">
<a href="https://www.domain.com/" style="text-decoration: none; color: #8c8c8c;">
this mail was sent from <span style="color:#009dab;">www.domain.com</span>
</a>
</td>
<td width="5" style="font-size: 1px; line-height: 1px;"> </td>
</tr>
</table>
</td>
</tr>
</table>
<!-- END MAIL FOOTER -->