【问题标题】:width for <td> in GMail has no effectGMail 中 <td> 的宽度无效
【发布时间】:2014-10-28 10:40:33
【问题描述】:

我有一个 HTML 电子邮件的设计,必须像这样显示


|图像'a'这里空间>>>>>>>>>>>>>>>>>>>图像'b'这里|


<table class="wrapper">
<tr>
    <td class="header" style="padding: 15px 15px 0;">

        <table class="max-width" cellspacing="0" cellpadding="0" style="width: 100%;">
            <tr>

                <!--RB logo-->
                **<td  style="width: 93% !important;vertical-align: top;">**
                    <table cellpadding="0" cellspacing="0">
                        <tr>
                            <td>
                                <a class="link-style" href="https://www.reportbee.com/" target="_blank">
                                    <img src="https://gallery.mailchimp.com/0135a40176b33deb024da1fea/images/d86f927a-3eef-4e8f-9dae-99753e62b0b5.png" alt="Report Bee" title="Report Bee"></a>
                            </td>
                        </tr>
                    </table>
                </td>

                <!--RB flag-->
                <td>
                    <table class="block" cellspacing="0" cellpadding="0">
                        <tr>
                            <td> <img src="https://gallery.mailchimp.com/0135a40176b33deb024da1fea/images/2cddc1b3-1e85-4759-8cb1-7e07e9a2d89c.png" alt=""></td>
                        </tr>
                    </table>
                </td>

            </tr>
        </table>
    </td>
</tr>

我尝试为包含我的第一张图片的图片指定宽度。但 Gmail 不接受宽度,它会将我的电子邮件显示为


| image'a'这里 image'b'这里 |


我做错了什么?

【问题讨论】:

  • 出于什么原因,您首先尝试为第二个表格添加宽度td
  • 那个 td 是包含我的图像'a'的东西。
  • 因为 Gmail 不接受图像的浮动属性我试图为第一个 td 指定宽度

标签: html css ruby-on-rails gmail html-email


【解决方案1】:

当我希望将两张图片放在电子邮件的两端时,我会使用:

<td width="40" align="left"><img></td>

<td width="100%"><img></td>

<td width="40" align="right"><img></td>

由于两个图像的宽度都是固定的,所以中间的间隔 100% 将图像推到外面。

【讨论】:

    【解决方案2】:

    如果您发送 html 电子邮件,只需在标题中传递以下信息

    MIME-Version: 1.0
    Content-type:text/html;charset=UTF-8
    

    主要是内容类型:**Content-type:text/html**

    为 html 电子邮件传递内容类型 text/html

    【讨论】:

      【解决方案3】:

      我以前遇到过这样的问题..在网上做了很多研究后,我知道样式标签和任何大多数 css 元素在 gmail 和 Outlook 中都不起作用

      所以如果你给 td 一个宽度,请把它变成 td width=" " 这样你就可以看到效果了

      【讨论】:

        猜你喜欢
        • 2014-07-23
        • 2013-02-12
        • 1970-01-01
        • 1970-01-01
        • 2013-12-30
        • 2012-02-29
        • 1970-01-01
        • 2013-05-18
        • 2017-01-30
        相关资源
        最近更新 更多