email - HTML layout is messed up in Microsoft Outlook E-mail client -


my application sends html e-mail users. when test plain html file, looks ok in various browsers (firefox, ie, chrome, safari, android phone browsers). displays fine in webmail clients have tested (gmail, yahoo mail).

but when view message in microsoft outlook, layout messed up. - right hand icon not top aligned, displayed lower left icon. html code:

<div style="width: 100%; margin: 0px auto; background-color: #333; border: 0px solid #333; color: #fff">    <!-- logos -->        <div style="background-color: #333; border: 0px solid #333; color: #fff; padding-top: 2px; padding-right: 2px; padding-left: 2px">            <a href="http://mywebsite.com" target="_blank" style="color: #333; "><img src="mylogo.png" height="30px" width="30px" alt="logo" border="0"></a>            <a href="mailto:?subject='.$email_subject.'&body='.$email_body.'" style="color: #333"><img src="image_1.png" height="27px" width="120px" align="right" alt="recommend" border="0"></a>        </div>    <!-- title -->        <div style="text-align: left; font-size:12px; padding-left: 2px; font-weight: bold;">            <span style="font-size:12px; padding-left: 2px; font-weight: bold;">comment line - should left aligned</span>        </div>        <div style="text-align: center; text-transform: uppercase; color: #ddd; font-size: 12px;font-weight: bold;">            <span><b>my title should centered</b></span>       </div>    </div> 

you may need more research on html email design. not same html web , should table based instead of divs. here basic example of how example code should look:

<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#333333">   <tr>     <td>       <table width="100%" border="0" cellpadding="0" cellspacing="0">         <tr>           <td align="left">             <a href=""><img style="margin: 0; border: 0; padding: 0; display: block;" src="mylogo.png" width="30px" height="10px" alt="logo"></a>           </td>         </tr>         <tr>           <td align="left" style="font-size:12px; padding-left: 2px; font-weight: bold; color:#dddddd;">             comment line - should left aligned           </td>         </tr>       </table>     </td>     <td align="right" valign="top">       <a href="mailto:?subject='.$email_subject.'&body='.$email_body.'"><img style="margin: 0; border: 0; padding: 0; display: block;" src="mylogo.png" width="120px" height="27px" alt="recommend"></a>     </td>   </tr>   <tr>     <td align="center" colspan="2" style="text-transform: uppercase; color: #dddddd; font-size: 12px; font-weight: bold;">       title should centered     </td>   </tr> </table> 

a couple of introduction email design resources:


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -