Search code examples
htmliphonecssemailgmail

Force Gmail for iPhone to render table cells at their designated widths?


Table cell widths are staggered in iPhone Gmail.

Is there a way to force Gmail for iPhone to render table cells at their designated widths? Oddly, the multi-slice rows expand to the set 'width:650'. The single slice rows are narrower although they are also set to 'width:650'.

As far as I can tell, my emails look perfect in all desktop email clients - even Outlook! It also looks fine in Mail for iPhone.

I've tried using 'border-collapse:collapse', 'width:100%' on the tables and td's, and finally 'table-layout:fixed'.

This is the HTML:

`

<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</title>
</head>
<body>
<img border="0" style="display:block;" src="spacer.gif" width="1" height="1" />
<table bgcolor="#fff" border="0" align="center" cellpadding="0" cellspacing="0" style="table-layout:fixed;width:650px;">
    <tbody>
        <tr> 
            <!--/*************** BEGIN LEAD ***************/ -->
            <td align="left" valign="top" bgcolor="#fff"  width="650"><a href="" style="font-family: Arial, Helvetica, sans-serif; font-size:12px; color:#040400; text-decoration:underline;line-height:20px;"><span id="part1">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</span></a></td>
            <!-- /*************** END LEAD ***************/ --> 
        </tr>
        <!-- /*************** BEGIN HEADER INC ***************/ -->
        <tr>
            <td align="center" valign="top" bgcolor="#fff"  width="650"><table width="650" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
                    <tr>
                        <td width="650"><span style="font-family: Arial, Helvetica, sans-serif; font-size:10px; color:#666; line-height:13px;margin-top:2px;"><a style="color:#666; text-decoration:underline;line-height:13px;" href="">XXXXXXXXXXXXXX</a><a href="" style="color:#666; font-size:10px; text-decoration:underline;line-height:13px;"></a> iXXXXXXXXXXXXXXXXXXX<a style="color:#666; text-decoration:underline;font-size:10px;line-height:13px;" href=""> XXXXXXXXXXXX</a>XXXXXXXXXXXXXXXXX<br />
                            <span style="font-weight:bold;">XXXXXXXXXXXXXXXXX</span> XXXXXXXXXXXXXXXX</span></td>
                    </tr>
                    <tr>
                        <td width="650"><img src="spacer.gif" width="650" height="46" border="0" style="display: block;" /></td>
                    </tr>
                    <tr>
                        <td><table id="Table_01" width="650" height="47" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td width="280"><a href=""> <img border="0" style="display:block;margin:0;padding:0;" src="spacer3_01.gif" width="280" height="47" alt="Territory Ahead"> </a></td>
                                    <td width="370"><img border="0" style="display:block;margin:0;padding:0;" src="spacer3_02.gif" width="370" height="47" alt=""></td>
                                </tr>
                            </table></td>
                    </tr>
                    <tr>
                        <td><table id="Table_01" width="650" height="31" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td width="97"><a href=""> <img border="0" style="display:block;margin:0;padding:0;" src="spacer3_03.gif" width="97" height="31" alt="Men's"> </a></td>
                                    <td width="90"><a href=""> <img border="0" style="display:block;margin:0;padding:0;" src="spacer3_04.gif" width="90" height="31" alt="Women's"> </a></td>
                                    <td width="93"><a href=""> <img border="0" style="display:block;margin:0;padding:0;" src="spacer3_05.gif" width="93" height="31" alt="Isabella Bird"> </a></td>
                                    <td width="132"><a href=""> <img border="0" style="display:block;margin:0;padding:0;" src="spacer3_06.gif" width="132" height="31" alt="Men's Clearance"> </a></td>
                                    <td width="83"><a href=""> <img border="0" style="display:block;margin:0;padding:0;" src="spacer3_07.gif" width="83" height="31" alt="Women's Clearance"> </a></td>
                                    <td width="155"><a href=""> <img border="0" style="display:block;margin:0;padding:0;" src="spacer3_08.gif" width="155" height="31" alt="eGift Cards"> </a></td>
                                </tr>
                            </table></td>
                    </tr>
                    <tr>
                        <td><table border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border-top: solid 1px #b69358;" width="650">
                                <tr>
                                    <td width="650" style="height:8px;" ></td>
                                </tr>
                            </table></td>
                    </tr>
                </table></td>
        </tr>
        <!-- /*************** END HEADER INC ***************/ --> 
        <!-- /*************** BEGIN PROMO ***************/ --> 
        <!-- /*************** END PROMO ***************/ -->
        <tr>
            <td align="center" valign="top" bgcolor="#fff"  width="650"><!-- /*************** BEGIN MAIN ***************/ -->

                <table id="Table_01" width="650" height="1595" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td width="650"><a href=""><img border="0" style="display:block;margin:0;padding:0;" src="spacer_01.gif" width="650" height="352" alt=""></a></td>
                    </tr>
                    <tr>
                        <td width="650"><a href=""><img border="0" style="display:block;margin:0;padding:0;" src="spacer_02.jpg" width="650" height="405" alt=""></a></td>
                    </tr>
                    <tr>
                        <td width="650"><a href=""><img border="0" style="display:block;margin:0;padding:0;" src="spacer_03.jpg" width="650" height="408" alt=""></a></td>
                    </tr>
                    <tr>
                        <td width="650"><a href=""><img border="0" style="display:block;margin:0;padding:0;" src="spacer_04.jpg" width="650" height="430" alt=""></a></td>
                    </tr>
                </table>

                <!-- /*************** END MAIN ***************/ --></td>
        </tr>
        <!-- /*************** BEGIN FOOTER INC ***************/ -->
        <tr>
            <td align="center" valign="top" bgcolor="#fff"  width="650"><table width="650" border="0" cellspacing="0" cellpadding="0">
                    <tbody>
                        <tr>
                            <td width="650"><table id="Table_01" width="650" height="32" border="0" cellpadding="0" cellspacing="0">
                                    <tbody>
                                        <tr>
                                            <td width="125"><img border="0" style="display:block;margin:0;padding:0;" src="spacer_01.gif" width="125" height="32" alt=""></td>
                                            <td width="88"><a href=""><img border="0" style="display:block;margin:0;padding:0;" src="spacer_02.gif" width="88" height="32" alt=""></a></td>
                                            <td width="158"><a href=""><img border="0" style="display:block;margin:0;padding:0;" src="spacer_03.gif" width="158" height="32" alt=""></a></td>
                                            <td width="105"><a href=""><img border="0" style="display:block;" src="spacer_04.gif" width="105" height="32" alt=""></a></td>
                                            <td width="31"><a href=""><img border="0" style="display:block;margin:0;padding:0;" src="spacer_05.gif" width="31" height="32" alt=""></a></td>
                                            <td width="31"><a href=""><img border="0" style="display:block;margin:0;padding:0;" src="spacer_06.gif" width="31" height="32" alt=""></a></td>
                                            <td width="112"><img border="0" style="display:block;margin:0;padding:0;" src="spacer_07.gif" width="112" height="32" alt=""></td>
                                        </tr>
                                    </tbody>
                                </table></td>
                        </tr>
                        <tr>
                            <td align="center" style="padding-top:20px;" width="650"><span style="font-family:Arial, Helvetica, sans-serif;font-size:10px;color:#666; line-height:13px;"><a style="font-size:10px;color:#666; text-decoration:none;" href="">XXXXXXXXXXXXXXXX</a> | <a style="font-size:10px; color:#666; text-decoration:none;" href="">XXXXXXXXXXXXXXX</a><br />
                                <br />
                                XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br />
                                XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br />
                                XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</span></td>
                        </tr>
                        <tr>
                            <td width="650"><span style="font-family: Geneva, Verdana, Arial, Helvetica, sans-serif; font-size:11px; color:#000;"><img src="spacer.gif" width="650" height="49" border="0" style="display: block;margin:0;padding:0;"></span></td>
                        </tr>
                    </tbody>
                </table></td>
        </tr>
        <!-- /*************** END FOOTER INC ***************/ --> 
        <!-- /*************** BEGIN DISC ***************/ -->
        <tr>
            <td align="left" valign="top" bgcolor="#fff"  width="650"><span style="font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000;">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</span></td>
        </tr>
        <!-- /*************** END DISC ***************/ -->
    </tbody>
</table>
</body>
</html>

`


Solution

  • Finally found the solution! For an image to render at full width in the Gmail mobile app, the img tag must contain the style property set to style="display:block;min-width:650px;. This forces the content to full width as the Gmail mobile app is programmed to 'auto-adjust' the size of elements within the email. Thanks for your help on this Jon!