html side by side tables in email are forced under in Outlook 2007 and above -
i have run first frustration outlook breaking html emails.
i have container table 640 px wide. in 2 320px tables 1 align left, 1 align right. site side side in email clients except word engined outlook (2007 , up).
this important part. have code make containing table become 320px wide when viewed on mobile phone. forces 2 tables 1 on top of other. works planned mobiles.
but outlook on desktop renders left aligned table, below it renders right hand table below left still aligned right, creating big gap beneath left hand table , big gap above right hand table.
<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <style> img {display:block;} {text-decoration:none;} a:hover {text-decoration: underline !important;} td.contentblock p { color:#ffffff; font-size:16px; font-family:'helvetica neue',helvetica,arial,sans-serif; margin-top:0; margin-bottom:12px; padding-top:0; padding-bottom:0; font-weight:normal; } td.contentblock p { color:#e45808; text-decoration:none; } .heading { font-size:24px; font-weight:bold; } @media screen , (max-device-width: 480px) { table[class="table"], td[class="cell"] { width: 320px !important; } td[class="footershow"] { width: 320px !important; } table[class="hide"], img[class="hide"], td[class="hide"], br[class="hide"], div[class="hide"] { display: none !important; } img[class="divider"] { height: 1px !important; } img[id="header"] { width: 320px !important; height: 69px !important; } img[id="main"] { width: 320px !important; height: 45px !important; } img[id="footer"] { width: 320px !important; height: 43px !important; } p[class="reminder"] { font-size: 11px !important; } span[class="secondary"] { line-height: 20px !important; margin-bottom: 15px !important; font-size: 13px !important; } } </style> </head> <body bgcolor="#e4e4e4" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" style="-webkit-font-smoothing: antialiased;width:100% !important;background:#e4e4e4;-webkit-text-size-adjust:none;"> <table width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#eeeeee"> <tr> <td bgcolor="#eeeeee" width="100%"> <table width="640" cellpadding="0" cellspacing="0" border="0" align="center" class="table"> <tr> <td width="640" class="cell" style="color:#fff;"> <table class="table" width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td bgcolor="#cc6600" class="contentblock cell" style="color:#ffffff;font-size:16px;font-family:'helvetica neue',helvetica,arial,sans-serif;"> <table width="320" bgcolor="#cc6600" cellpadding="0" cellspacing="0" border="0" align="left"> <tr> <td> <a href="#" target="_blank" title="#" style="text-decoration:none;color:#fff;"><img src="http://www.example.com/image_01.png" alt="#" width="320" height="167" border="0" style="display:block;" /></a> </td> </tr> </table> <table width="320" bgcolor="#cc6600" cellpadding="0" cellspacing="0" border="0" align="right"> <tr> <td> <a href="#" target="_blank" title="#" style="text-decoration:none;color:#fff;"><img src="http://www.example.com/image_02.png" alt="#" width="320" height="167" border="0" style="display:block;" /></a> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </body> </html> if 1 me find way still have 2 side side tables in outlook, still have them re-align 1 under other in mobile phones, appreciative.
the quick answer make widths of inner tables few pixels smaller. stands, outlook adds few pixels in between them causing 320 + (couple pixels) + 320 > 640.
a more accurate way though add mso-table-lspace , mso-table-rspace reduce gap. see this example.
Comments
Post a Comment