So below is this table. It essentially creates a grid of images that goes into an email. because it is an email I need the styling to be in-line. The grid looks great on a desktop but when viewed on a mobile device each table aligns to the left leaving a white space to the right. however, if I change the align tag, the grid no longer works on desktop.
Is there a way with in-line stylings to either get the content to align to the center when viewed on mobile only Or at least get the table to fill the container when viewed on a smaller screen?
<tbody>
<tr>
<td>
<tr><td align="left" style=" border-collapse:collapse;font-family:'Archivo',Arial,sans-serif" valign="top">
<table align="left" border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;font-family:'Archivo',Arial,sans-serif"><tbody><tr><td align="left" style="border-collapse:collapse;font-family:'Archivo',Arial,sans-serif" valign="top">
<img style="border:0;height:auto;outline:none;text-decoration:none;margin:0;display:block;padding:0!important" width="226" src="#">
</tr></td></tbody></table>
<table align="left" border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;font-family:'Archivo',Arial,sans-serif"><tbody><tr><td align="left" style="border-collapse:collapse;font-family:'Archivo',Arial,sans-serif" valign="top">
<img style="border:0;height:auto;outline:none;text-decoration:none;margin:0;display:block;padding:0!important" width="226" src="#" /></tr></td></tbody></table>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;font-family:'Archivo',Arial,sans-serif"><tbody><tr><td align="left" style="border-collapse:collapse;font-family:'Archivo',Arial,sans-serif" valign="top">
<img style="border:0;height:auto;outline:none;text-decoration:none;margin:0;display:block;padding:0!important" width="226" src="#" /></tr></td></tbody></table>
</td>
</tr>
<tr><td align="left" style=" border-collapse:collapse;font-family:'Archivo',Arial,sans-serif" valign="top">
<table align="left" border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;font-family:'Archivo',Arial,sans-serif"><tbody><tr><td align="left" style="border-collapse:collapse;font-family:'Archivo',Arial,sans-serif" valign="top">
<img style="border:0;height:auto;outline:none;text-decoration:none;margin:0;display:block;padding:0!important" width="226" src="#">
</tr></td></tbody></table>
<table align="left" border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;font-family:'Archivo',Arial,sans-serif"><tbody><tr><td align="left" style="border-collapse:collapse;font-family:'Archivo',Arial,sans-serif" valign="top">
<img style="border:0;height:auto;outline:none;text-decoration:none;margin:0;display:block;padding:0!important" width="226" src="#" /></tr></td></tbody></table>
<table align="left" border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;font-family:'Archivo',Arial,sans-serif"><tbody><tr><td align="left" style="border-collapse:collapse;font-family:'Archivo',Arial,sans-serif" valign="top">
<img style="border:0;height:auto;outline:none;text-decoration:none;margin:0;display:block;padding:0!important" width="226" src="#" /></tr></td></tbody></table>
</td>
</tr>
</tbody>
</table>```
I do not know if the table is so important to use ,
but you can do this by simply put the images in for example and the div style will be:
{
display: flex;
flex-direction: column;
align-items: center;
width: '100[%,vw]'; // may not necessary
}
css flex is so important for responsive design.
if not, put your table within div and give the style to the div
mobile device size (width) is generaly <= 768px (without resolution)
Related
hello longtime lurker first time asker - im having an issue with outlook 14 on iOS. I send a test send and it begins to render the mobile view as it should look then it gets to a point and sizes everything down as if its desktop. coupla code blocks for reference:
<table align="center" border="0" cellpadding="0" cellspacing="0" class="wrapper" style="width:600px;" width="600">
<tr>
<td align="center" bgcolor="#EAE6DD" height="auto" style="background-size:cover;height:auto; background-position:center;" valign="middle">
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top">
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
<!-- IMAGES AND TEXT SIT WITHIN THIS AREA -->
<tr>
<td align="center" class="hide" style="width:600px;" valign="top" width="600">
<img alt="Hey! you've earned this - enjoy a burg on us!" border="0" src="https://image.email.grilld.com.au/lib/fe3915707564067c721778/m/1/Taken_GIF_v2.gif" style="display:block;font-family:Arial, sans-serif;color:#ffffff;font-weight:bold;font-size:24px;max-width:600px;" width="600"></td><!--[if !mso 9]><!--><td align="center" valign="top">
<div class="mobile_show" style="display:none;width:0;overflow:hidden;max-height:0!important">
<table align="center" border="0" cellpadding="0" cellspacing="0" class="wrapper" width="100%">
<tr>
<td align="center" style="width:600px;" valign="top" width="600">
<img alt="Hey! you've earned this - enjoy a burg on us!" border="0" height="auto" src="https://image.email.grilld.com.au/lib/fe3915707564067c721778/m/1/Taken_GIF_mobile_v2.gif" style="display:block;font-family:Arial, sans-serif;color:#ffffff;font-weight:bold;font-size:24px;max-width:600px;" width="100%"></td></tr></table></div></td><!--<![endif]--></tr><!-- IMAGES AND TEXT SIT WITHIN THIS AREA --></table></td></tr></table><!--[if gte mso 9]>
</v:textbox>
</v:rect>
<![endif]--></td></tr></table>
<table align="center" border="0" cellpadding="0" cellspacing="0" class="wrapper" style="width: 600px;" width="600">
<tr>
<td align="center" bgcolor="#EAE6DD" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td style="width: 30px;" width="30">
</td><td align="center" valign="top">
<table align="center" border="0" cellpadding="0" cellspacing="0" class="intro_width_mobile">
<tr>
<td height="20" style="height:20px; line-height:1px; font-size:1px;">
</td></tr><tr>
<td align="center" class="black" style="color:#000000; font-family:'Custom Font 1','Helvetica Neue',Helvetica, Arial, sans-serif; font-size:16px; line-height:21px; width:100%; max-width:464px; margin:0 auto; Margin:0 auto" valign="top" width="100%">
There's more where that came from, so stop by again soon.<br>
<br>
Burg apetit!<br>
</td></tr><tr>
<td height="20" style="height:20px; line-height:1px; font-size:1px;">
</td></tr></table></td><td style="width:30px;" width="30">
</td></tr></table></td></tr></table>
TIA for your help
Outlook apps try and 'fix' your large images by adding a max-width:100% to their CSS. But if you use e.g. max-width:600px as you are, it will be overridden. You can overwrite this by using max-width:600px!important inline (or an id on your body, e.g. #body .myimage {max-width:600px!important}).
Alternatively, you could rely on width:100%, which you don't have on your first image.
That's probably the trigger (big images or tables which it can't resize properly). Let us know if that doesn't solve it.
I am attempting to include two images as a header in an e-mail, using pure HTML. One image will cover 40% of the screen width, and the other 60% width (the height for both is just auto). However, the max width for both images combined is 750px, so on large desktop devices, the combined width doesn't stretch further than that.
I learned of a trick involving setting td's to a width of 0 before and after the primary content, which works well for text, but not so well for my images. Here's my code right now:
<table width="750" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="0"></td>
<td width="40%" valign="middle"><img src="myimg.png" alt="Text" style="margin: 0; border: 0; padding: 0; display: block; width: 40%;" /></td>
<td width="60%" valign="middle"><img src="myimg.png" alt="Text" style="margin: 0; border: 0; padding: 0; display: block; width: 60%;" /></td>
<td width="0"></td>
</tr>
</table>
And here is how the images should be displayed
The code isn't working unfortunately; the images always get a fixed width. I've tried removing the empty td's, I've tried using fixed widths instead of percentages, I've tried using width by itself and as a style, I've tried all kinds of variations on putting the widths in different places, but seemingly no matter what I try, I am unable to display the images responsively, side by side. This is an issue on smartphone devices, where the images appear too large. Naturally, I cannot use media queries, as they are not supported in Outlook.
Any suggestions for how I could display the two images side by side responsively?
Thank you!
Best,
Javert
Try this One. Hope it Helps.
<div style="width:750px;">
<table style="width:100%;">
<tr>
<td style="width:40%; background-color: red; height:150px;"></td>
<td style="width:60%; background-color: yellow; height:150px;"></td>
</tr>
</table>
</div>
I was doing the same with mailchimp HTML/Code section, may be helpful for someone.
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnImageGroupBlock" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;" >
<tbody class="mcnImageGroupBlockOuter">
<tr>
<td valign="top" style="mso-line-height-rule: exactly;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;width" class="mcnImageGroupBlockInner">
<!--[if mso]>
<table align="left" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100%;">
<tr>
<![endif]-->
<!--[if mso]>
<td valign="top" width="600" style="width:600px;">
<![endif]-->
<table align="left" width="300" border="0" cellpadding="0" cellspacing="0" class="mcnImageGroupContentContainer" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<tbody><tr>
<td class="mcnImageGroupContent" valign="top" style=";mso-line-height-rule: exactly;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<img alt="" src="https://via.placeholder.com/300.png/09f/fff" width="300" style="max-width: 600px;padding: 0;border: 0;height: auto;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;vertical-align: bottom;" class="mcnImage">
</td>
</tr>
</tbody></table>
<table align="center" width="300" border="0" cellpadding="0" cellspacing="0" class="mcnImageGroupContentContainer" style="border-collapse: collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<tbody><tr>
<td class="mcnImageGroupContent" valign="top" style="mso-line-height-rule: exactly;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<img alt="" src="https://via.placeholder.com/300.png/09f/fff" width="300" style="max-width: 600px;padding: 0;border: 0;height: auto;outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;vertical-align: bottom;" class="mcnImage">
</td>
</tr>
</tbody></table>
<!--[if mso]>
</td>
<![endif]-->
<!--[if mso]>
</tr>
</table>
<![endif]-->
</td>
</tr>
</tbody>
</table>
I'm trying to make sure all the padding aligns as well as the text and logo aligning in this html.
The code I've used to make everything align is listed below.
<table cellpadding="0" cellspacing="0" style="width: 580px;table-layout: auto;" width="580">
<tbody>
<tr>
<td align="left" valign="top" style="font-family:'Arial, 'Georgia', Times New Roman, serif;font-weight:normal;font-size:15px;mso-line-height-rule:exactly;line-height:19px; color:#000000;" class="" width="400">
<div class="ee_editable" style="position: static;">
<div class="" style="padding-top: 10px;"><br></div>
<div class="headline">DISCOVER OUR<br> LATEST OFFERS</div>
<div> </div>
</td>
<td width="180">
<a href="https://dmtrk.net/t/20AS-67H0B-UDWVGK-3JC7VW-1/c.aspx" target="_blank">
<img src="http://www.kindlewood.co.uk/bmw_images/minilogo180x80.png" alt="MINI" width="117" height="52" class="ee_editable ee_smallimage ee_pnggif_image" title="MINI" align="right" border="0">
</a>
</td>
</tr>
<tr>
<td class="ee_dropzone" width="580" align="left" style="width: 580px;">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="ee_element ee_imageelement" ee-type="element" data-title="Image" style="width: 580px;table-layout: auto;">
<tbody>
<tr>
<td style="font-size: 1px; line-height: 1px;" class=""><img border="0" src="https://i.emlfiles4.com/cmpimg/0/0/7/3/9/files/10607126_day10mniheader.png" style="width: 100%; min-height: auto; display: block; max-width: 100%;" class="ee_editable" width="580"></td>
</tr>
</tbody>
</table>
The above code is wrapped in a code like this:
<table border="0" cellpadding="0" cellspacing="0" width="640" style="width: 640px; background-color: rgb(255, 255, 255);table-layout: auto;" class="w320" bgcolor="#ffffff">
<tbody>
<tr>
<td align="center" style="min-width: 320px; padding-top: 0;padding-right: 0;padding-bottom: 0;padding-left: 0;" width="640">
<table cellpadding="0" cellspacing="0" style="width: 580px;table-layout: auto;" width="580">
Right now, the page displays as so:
But I need the white mini pic, text and logo to align with the rest of the page. Thanks for any input!
You need to span the td with the image across two columns, since the row above as two td's, if that makes sense.
So if you change
<td class="ee_dropzone" width="580" align="left" style="width: 580px;">
to
<td colspan="2" class="ee_dropzone" width="580" align="left" style="width: 580px;">
you should be good to go.
I am trying to produce a HTML/CSS eBay store template for my friend.
It looks fine on my PC with Chrome and IE but on his Mac and iPhone (both using Safari) the layout isn't displayed as we would like.
On the left column, the menu items should be displayed at the top of the column but on Safari they are displayed at the bottom of the column.
Please does anyone know of a fix for this Safari positioning behaviour?
P.S. The out-dated table tags are automatically added when you upload the template.
<table width="100%" cellspacing="0" cellpadding="0">
<tbody>
<tr><td colspan="3" rowspan="1" height="15"><img width="1" height="15" src="http://pics.ebaystatic.com/aw/pics/s.gif"></td></tr>
<tr><td align="left" colspan="1" rowspan="1" valign="top" id="LeftPanel" width="210" height="100%" style="word-wrap:break-word;"><table border="0" cellpadding="0" cellspacing="0" width="100%" class="v4thldr"><tbody><tr>
<td><div><div style="padding:0px 0px 0px 0px;width:100%;float:left;font-size:14pt;color:#FFFFFF">
<div style="background-color:#CCCCCC;padding-left:5px"><h5 class="icon-title" style="font-size:16pt;padding:0;margin-bottom: 0.5em;text-transform:none">Title 1</h5></div>
<div style="clear:both;width:100%">
Menu 1 Items
<div style="background-color:#CCCCCC;padding-left:5px"><h5 class="icon-title" style="font-size:16pt;padding:0;margin-bottom: 0.5em;text-transform:none;margin-top:20px">Title 2</h5></div>
Menu 2 Items
</div>
</div></div></td></tr></tbody></table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="v4thldr"><tbody><tr><td>
<div><div style="padding:0px 0px 0px 0px;width:100%;float:left;font-size:14pt;margin-top:20px">
<div style="background-color:#CCCCCC;padding-left:5px"><h5 class="icon-title" style="font-size:16pt;padding:0;margin-bottom: 0.5em;text-transform:none">Newsletter Signup Title</h5></div>
<div style="clear:both;width:100%">
Newsletter Signup Box Content
<div style="background-color:#CCCCCC;padding-left:5px"><h5 class="icon-title" style="font-size:16pt;padding:0;margin-bottom: 0.5em;text-transform:none;margin-top:20px">Payment Methods Title</h5></div>
Payment Methods Content
</div>
</div></div>
</td></tr></tbody></table></td>
<td colspan="1" rowspan="1" width="13"><img width="13" height="1" src="http://pics.ebaystatic.com/aw/pics/spacer.gif"></td><td colspan="1" rowspan="1" valign="top">
<table width="100%" cellspacing="0" cellpadding="0"><tbody><tr><td colspan="1" rowspan="1">
<table id="TopPromoArea" cellspacing="0" cellpadding="0" border="0" width="100%"></table>
</td></tr><tr><td align="left" colspan="1" rowspan="1" valign="top" id="CentralArea">
<div style="width:100%;background-color:#FFFFFF;padding:20px 20px 20px 20px;float:left">
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="v4stw">
// Long list of items here
</table>
</div></td></tr></tbody></table>
<br clear="none">
</td>
</tr></tbody></table>
I found the issue was due to reset.css declaring "vertical-align:bottom" which only seemed to affect Safari. I have now removed this line and is working fine now.
I have an html email set up as
<td valign="top"><table width="650" cellspacing="0" cellpadding="0" bgcolor="#ffffff" align="center">
<tr>
<td width="25" valign="top">
<img src="/images/left_border.jpg" border="0" align="right" style="padding:0; display: block;">
</td>
<td width="600" valign="top" style="padding: 0px;">
<img src="/images/banner.jpg" border="0" align="left" style="padding:0; display: block;">
</td>
<td width="25" align="left">
<img src="/images/right_border.jpg" border="0" align="left" style="padding:0; display: block;">
</td>
</tr>
</table>
</td>
However in outlook 2003 and entourage email clients, it appears as an additional border on left and right sides.
How can it be resolved?
It's not going to work well in Outlook 2007+ either because you're using non-compatible tags including padding: and display:. So, back to the drawing board all around. Here's a refresher on what the various browsers support: http://www.campaignmonitor.com/downloads/documents-tools/Campaign_Monitor_Guide_to_CSS_Support_in_Email_27_Aug_2009.pdf
Technically, the code you posted is invalid because it starts with a <td> which has to be inside a <table> and <tr> to be valid. I'm suspecting you posted just a snippet, so perhaps providing the entire context would be best.