Email template td not stacking for mobile? - html

I am trying to stack two table cells under each other when the email template is viewed on mobile. Although the code works when viewing the email in the browser, it doesn't within mobile email clients?
How can I make the table stack for mobile layout?
Media Query:
#media only screen and (max-width: 600px) {
*[class=hero-block] {
width: 100%;
display: block !important;
text-align: center;
clear: both;
}
}
HTML:
<table bgcolor="000000" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="hero-block">
<img src="hero.jpg" height="265" width="245" />
</td>
<td class="hero-block" width="295">
<table bgcolor="000000" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left">
<font color="#ffffff" face="Arial,Verdana,sans-serif" size="1" style="font-size: 22px; line-height: 22px;">Thanks for signing up</font>
</td>
</tr>
<tr>
<td>
<img style="display: block; border:0; margin: 0; padding: 0;" src="x.gif" height="20" width="1" alt="x" />
</td>
</tr>
</table>
</td>
</tr>
</table>

TD's have stopped stacking in Android for quiet sometime now. A walkaround is to use TH instead, which works on both Android and iOS. Try out my code below in a test email:
#media only screen and (max-width: 600px) {
*[class=hero-block] th{
width: 100%;
display: block !important;
text-align: center;
clear: both;
}
}
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="hero-block">
<tr>
<th align="left" style="font-weight:normal;" bgcolor="#000000">
<font color="#ffffff" face="Arial,Verdana,sans-serif" size="1" style="font-size: 22px; line-height: 22px;">Thanks for signing up</font>
</th>
<th align="left" style="font-weight:normal;" bgcolor="#ffffff">
<font color="#000000" face="Arial,Verdana,sans-serif" size="1" style="font-size: 22px; line-height: 22px;">Thanks for signing up</font>
</th>
</tr>
</table>
When using this code be sure to use font-weight as normal otherwise your text inside the block will be bold.
Cheers

Related

IOS Gmail App White Spacing Issue Above Image

There appears to be a white line above the image in Gmail app on IOS in dark mode.
I've tried many solutions regarding this but could not remove the white line/space.
img[class="visual"] {
width: 100% !important;
height: auto !important;
text-align: center;
margin: 0 auto;
}
<tr>
<td bgcolor="transparent" valign="middle">
<table cellpadding="0" cellspacing="0" border="0" class="content" align="center" width="640">
<tr>
<td bgcolor="transparent" align="center" valign="top" style="width: 640px;">
<img src="https://via.placeholder.com/150.jpg" width="640" height="250" style="display: block; border: none; max-height: 250px;" border="0" alt="Banner" class="visual" />
</td>
</tr>
</table>
</td>
</tr>

Width not working on table cells

For some reason when I set the width for a cell in a table it does not affect the width of the cell. FYI I'm using inline styles for mailers.
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center">
<table cellpadding="0" cellspacing="0" width="550" style="width: 100%; max-width: 550px; text-align: center; border: 1px solid #003a4b;">
<tr>
<td style="padding-top: 10px;"><span style="font-family: helvetica, sans-serif; font-size: 37px; font-weight: bold; color: #93d600; border-bottom: 1px solid #003a4b;">Hunters Conference 2017</span></td>
</tr>
<tr>
<td width="80%" style="padding: 20px 0; background-color: blue;"><span style="font-family: helvetica, sans-serif; font-size: 16px; color: #003a4b; background-color: red;">Fyber were honoured to attend and support such a fantastic conference, congratulations to everyone that won a prize on our wheel of fortune!</span></td>
</tr>
<tr>
<td width="80%" style="padding: 0 55px; padding-bottom: 20px;"><span style="font-family: helvetica, sans-serif; font-size: 16px; color: #003a4b;">We hope you all had a great day, we enjoyed catching up with everyone and it was nice to see our clients face to face. </span></td>
</tr>
<!--[if mso]>
<tr>
<td style="padding-bottom: 20px;">
<img src="https://gallery.mailchimp.com/b083c967cd22e35ab4ce75e7a/images/2c3e3b5e-9a9f-4864-a36f-6359b0dd4b75.jpg" alt="Spinning Wheel" width="550" style="width: 100%; max-width: 550px;">
</td>
</tr>
<![endif]-->
<!--[if !mso]><!-- -->
<tr>
<td style="padding-bottom: 20px;">
<img src="https://gallery.mailchimp.com/b083c967cd22e35ab4ce75e7a/images/19e810cd-df47-474b-aa47-3f33bf26922a.gif" alt="Spinning Wheel" width="550" style="width: 100%; max-width: 550px;">
</td>
</tr>
<!--<![endif]-->
</table>
</td>
</tr>
</table>
https://jsfiddle.net/xmbsemje/
td's default behaviour is to fill the width of the table, so if you only have one <td> per row <tr>, it would always go full width of the table no matter what you do.
One approach is to create a table inside that td and put the width on table instead. Also padding left and right doesn't work in emails, so creating tables with defined width and centering them is the best option.
The other approach would be to have spacer cells on left and right to give you padding space. I modified your code (just the text cells with blue/red and white background) following the first approach.
Please note: I didn't fix all of your code, just change a couple to get you started
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center">
<table cellpadding="0" cellspacing="0" width="550" style="width: 100%; max-width: 550px; text-align: center; border: 1px solid #003a4b;">
<tr>
<td style="padding-top: 10px;"><span style="font-family: helvetica, sans-serif; font-size: 37px; font-weight: bold; color: #93d600; border-bottom: 1px solid #003a4b;">Hunters Conference 2017</span></td>
</tr>
<tr>
<td align="center" style="padding: 20px 0; background-color: blue;">
<table border="0" cellpadding="0" cellspacing="0" style="width:80%;">
<tr>
<td align="left"><span style="font-family: helvetica, sans-serif; font-size: 16px; color: #003a4b; background-color: red;">Fyber were honoured to attend and support such a fantastic conference, congratulations to everyone that won a prize on our wheel of fortune!</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center" style="padding: 20px 0;">
<table border="0" cellpadding="0" cellspacing="0" style="width:80%;">
<tr>
<td align="left"><span style="font-family: helvetica, sans-serif; font-size: 16px; color: #003a4b;">We hope you all had a great day, we enjoyed catching up with everyone and it was nice to see our clients face to face. </span></td>
</tr>
</table>
</td>
</tr>
<!--[if mso]>
<tr>
<td style="padding-bottom: 20px;">
<img src="https://gallery.mailchimp.com/b083c967cd22e35ab4ce75e7a/images/2c3e3b5e-9a9f-4864-a36f-6359b0dd4b75.jpg" alt="Spinning Wheel" width="550" style="width: 100%; max-width: 550px;">
</td>
</tr>
<![endif]-->
<!--[if !mso]><!-- -->
<tr>
<td style="padding-bottom: 20px;">
<img src="https://gallery.mailchimp.com/b083c967cd22e35ab4ce75e7a/images/19e810cd-df47-474b-aa47-3f33bf26922a.gif" alt="Spinning Wheel" width="550" style="width: 100%; max-width: 550px;">
</td>
</tr>
<!--<![endif]-->
</table>
</td>
</tr>
</table>
last td width 550px so not effect your width 80%;
so you can add width on span tag

Outlook 2007 and 2010 placing white spaces between images

I have been searching for a fix for this for days and have inserted many different CSS and HTML tags that aren't fixing my issue. I have four separate images in their own tables (as I read that Outlook puts in breaks where it's decided a page should end) but there is an enormous pixel break being inserted between my third and fourth image. Any tips at all are welcome. I removed some of the code for privacy but this is the general format I've used for each of the four images. Thanks!
<div>
<table style="width: 600px; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td align="center" valign="top" style="line-height: 1px; font-size: 0.0em;"><img alt="BlahBlahBlah" src="http://hosting-source.bm23.com/35156/public/abc.jpg" border="0" height="1053" usemap="#Map" width="600" style="color: white; font-size: 12px; display: block;" /></td>
</tr>
</tbody>
</table>
<table style="width: 600px; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr style= "page-break-before: always">
<td align="center" valign="top" style="line-height: 1px; display: block; font-size: 0.0em;"><img alt="BlahBlahBlah" src="http://hosting-source.bm23.com/35156/public/abc2jpg" border="0" height="870" usemap="#Map2" width="600" style="color: white; font-size: 12px; display: block;" /></td>
</tr>
</tbody>
</table>
</div>
<p> </p>

How can I dynamically adjust a web page between desktops and smartphones?

He is my code and I am trying to let my html code to adjust dynamically according to the screen sizes, but my html code doesn't look like it is working. Where should I change in my code?
<body bgcolor="#F6F9FC" width="100%" style="margin-top: 0px; margin-left: 0px; margin-right: 0px; margin-bottom: 0px;">
<div style="border-width: background-color: #0A2948; 0px; margin-top: 0px; margin-left: 0px; margin-right: 0px; width: 100%; margin-bottom: 0px; height: 55px;">
<center>
<table width="100%" height="100%">
<tr height="55px">
<td width="100%" bgcolor="#0A2948" style="font: 12pt 'Verdana'; color: white; font-weight: bold;">
<center>
<table width="55%">
<tr>
<td valign="middle" width="55%" align="left">
<font color="Orange">T</font>eam<font color="Orange"> M</font>ates
</td>
<td valign="middle" align="right" width="5%">
<img src='<%=request.getContextPath()%>/resources/search.jpg' border="0"/>
</td>
<td valign="middle" align="left" width="10%" style="font: 10pt 'Verdana'; color: white; font-weight: normal;">
Project
</td>
<td valign="middle" align="right" width="5%">
<img src='<%=request.getContextPath()%>/resources/matesearch.jpg' border="0"/>
</td>
<td valign="middle" align="left" width="10%" style="font: 10pt 'Verdana'; color: white; font-weight: normal;">
Mates
</td>
<td valign="middle" align="right" width="5%">
<img src='<%=request.getContextPath()%>/resources/write.jpg' border="0"/>
</td>
<td valign="middle" align="left" width="10%" style="font: 10pt 'Verdana'; color: white; font-weight: normal;">
<a href> Write</a>
</td>
</tr>
</table>
</center>
</td>
</tr>
</table>
</center>
</div>
</body>
It is not so clear what you are trying to achieve. Using a relative unit such as percentage like you did in your question, tells the browser that an element’s size is relative to that of its parent. And it is working in your example.
Perhaps you are looking for a way to say:
if the screen width is less than n, then arrange elements in this fashion
Frameworks such as Bootstrap make it easier to accomplish scaling. What they use are called media queries. Here is an example of a media query:
#media (max-width: 600px) {
.someClass {
width: 70%;
background-color: red;
}
}
The latter media query would apply if the screen width is less or equal to 600px.

Double images in Outlook on email

I am doing a responsive email where I can move the images if the email is being viewed on mobile.Everything looks great except in Outlook. It is displaying it in both places. I read that outlook does not recognize the "display:none" code. Is there anything else that can be done?
Here is what I have my code looking like and its working on everything but outlook.
Media Query Code
#media only screen and (max-device-width: 479px) {
#mobile {display:block}
#desktop {display:none;mso-hide: all;}
}
#media only screen and (min-device-width: 480px) {
#mobile {display:none;mso-hide: all;}
#desktop {display:block}
}
}
And here is the html I am using.
<table id="mobile" align="right" width="35%" cellpadding="0" cellspacing="0" border="0" class="deviceWidth">
<tr>
<td valign="top" align="right" class="hisrc">
<p style="mso-table-lspace:0;mso-table-rspace:0; margin:0; font-family:Helvetica, sans-serif; font-size:11px; color:323338; text-align:left; line-height:15px;">
<img src="vna-logo.png" alt="" border="0" style="padding-bottom:18px;border-radius: 4px; width: 220px;" class="deviceWidth" />
</td>
</tr>
</table>
<table id="desktop" align="right" width="35%" cellpadding="0" cellspacing="0" border="0" class="deviceWidth">
<tr>
<td valign="top" align="right" class="hisrc">
<p style="mso-table-lspace:0;mso-table-rspace:0; margin:0; font-family:Helvetica, sans-serif; font-size:11px; color:323338; text-align:left; line-height:15px;">
<img src="vna-logo-2.png" alt="" border="0" style="padding-bottom:18px;border-radius: 4px; width: 220px;" class="deviceWidth" />
</td>
</tr>
</table>
<table id="mobile" align="right" width="35%" cellpadding="0" cellspacing="0" border="0" class="deviceWidth" style="display:none;">
Should hide mobile version by default, will stay hidden on clients where queries are not accepted