适用于Android的Gmail App上的背景图片

时间:2016-06-23 10:39:12

标签: android css gmail html-email

是否有办法让HTML电子邮件的td中包含的背景图片显示在Gmail App for Android上。它似乎适用于iOS版Gmail应用程序。

以下是代码:

<table width="100%" style="table-layout: fixed; margin: 0 auto; width:100% !important; min-width: 100% !important; height:auto !important;" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td align="center">
        <table align="center" width="760" style="table-layout: fixed; margin: 0 auto; min-width: 760px;" border="0" cellspacing="0" cellpadding="0" class="w100pc">
            <tr>
                <td height="20" style="font-size: 0px; padding: 0px; margin: 0px; line-height: 0px;"></td>
            </tr>
            <tr>
                <td>
                    <table border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td valign="top" background="https://placeholdit.imgix.net/~text?txtsize=33&txt=760%C3%97340&w=760&h=340" bgcolor="#323232" width="760" height="340" style="min-width: 760px; background:url(https://placeholdit.imgix.net/~text?txtsize=33&txt=760%C3%97340&w=760&h=340) no-repeat center center; background-color: #323232; background-position: center center;" class="w100pcmbg">
                                <!--[if gte mso 9]>
                                <v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:760px;height:340px;">
                                <v:fill type="tile" src="https://placeholdit.imgix.net/~text?txtsize=33&txt=760%C3%97340&w=760&h=340" color="#323232" />
                                <v:textbox inset="0,0,0,0">
                                <![endif]-->
                                <div>
                                    <table align="center" width="600" cellspacing="0" cellpadding="0" border="0" style="min-width: 600px; margin: 0 auto;" class="w100pc">
                                        <tr>
                                            <td align="left" valign="top" height="15" colspan="3" style="font-size: 0px; padding: 0px; margin: 0px; line-height: 0px;"></td>
                                        </tr>
                                        <tr>
                                            <td align="left" valign="top" width="20" style="font-size: 0px; padding: 0px; margin: 0px; line-height: 0px;" class="w80"></td>
                                            <td align="left" valign="top" height="260" style="line-height: 25px !important; line-height: 25px; font-size: 18px !important; padding: 0px; margin: 0px; display: block; float: left;">
                                                <span style="font-family: 'Century Gothic', Verdana, sans-serif; line-height: 25px  !important; font-size: 18px !important; line-height: 25px; padding: 0px; margin: 0px; display:block; color: #787878; font-weight: bold;">
                                                    Lorem ipsum. Lorem upsum. Lorem ipsum. Lorem upsum. Lorem ipsum. Lorem upsum. Lorem ipsum. Lorem upsum. Lorem ipsum. Lorem upsum. Lorem ipsum. Lorem upsum. 
                                                </span>
                                            </td>
                                            <td align="left" valign="top" width="20" style="font-size: 0px; padding: 0px; margin: 0px; line-height: 0px;" class="w80"></td>
                                        </tr>
                                        <tr>
                                            <td align="left" valign="top" height="15" colspan="3" style="font-size: 0px; padding: 0px; margin: 0px; line-height: 0px;"></td>
                                        </tr>
                                    </table>
                                </div>
                                <!--[if gte mso 9]>
                                </v:textbox>
                                </v:rect>
                                <![endif]-->
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td height="20" style="font-size: 0px; padding: 0px; margin: 0px; line-height: 0px;"></td>
            </tr>
        </table>           
    </td>
</tr>

小提琴:https://jsfiddle.net/uvpb0ydc/1/

1 个答案:

答案 0 :(得分:7)

您的代码在Android上的gmail应用程序中运行良好。 如果您使用Litmus进行测试,那么图像将不会显示..它是一个用于gmail app的石蕊渲染的bug:)

enter image description here