简体   繁体   English

在 Outlook Windows 中向表格元素添加了额外的填充

[英]Extra padding added to table element in Outlook Windows

Here is my HTML:这是我的 HTML:

<table align="center" border="0" cellpadding="0" cellspacing="0" id="wrapper"
  style="max-width: 550px; padding-top: 10px; width: 100% !important; " width="100%">
  <!--[if mso]><center><tr><td><table border="0" cellpadding="0" cellspacing="0" width="550"><![endif]-->
  <tr>
    <td style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt ; ">
      <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
          <td style=" font-family: Helvetica, Arial, sans-serif; font-size: 16px; line-height: 150%; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; padding: 0 10px ; ">
            <table bgcolor="#90ee90" border="0" cellpadding="0" cellspacing="0" style="margin: 28px 0px; padding: 0;" width="100%">
              <tbody>
                <tr>
                  <td>
                    <!--[if mso]>
                    <table align="left" border="0" cellpadding="0" cellspacing="0" style="width: 30%;" width="165">
                    <tr>
                    <td style="padding-right: 20px">
                    <![endif]-->
                      <img align="left" style="width: 30%; margin-right: 4%;" width="165" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAh1BMVEUxMjH8/v8tLixQUVEYGhjU0tT29/ghHx/P0dIhIiEnKScVFhXm6OqCf4CnqKnW1dUbHBvb3N/JyMlYVVUAAAANDwyGh4lEPz8kJSO5u734+vuwsLGdnJ3v8PFBQUEqKSlJSklfX1+enp+Uk5Vzc3N5d3cBBgC9v8CDhIRpaGloZGVFRkY6OjlfBncRAAADPklEQVR4nO3Z6XKiQBSGYWQIkUUFAw4ad03U0fu/vlGkEfXQahFTUvU+vxJz6PQnbS9oGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACeyBQ9UCrX5tckjmVZQaKrKmn3duN3cf6IpJbNqVyraT3x/iz6zWazO5x5TmmV3GxqVjmgN2+IYqHW6si1H2VvtOsMR3nVaB64YpX5V2421U2qBlyUtCwmbD6W0FvaZ3X2LHg0YVfqxyOsXlnTP5Awbl9V9qSImoRv3tMC/kDCYCiUboSBWp4wFO/5A4J1acDqCc0PqXTwSELfqziTJq3ygNUTemEh1+nHz+sZtSyhH1QMaG47b0rWBT9/QRwfKuGpLNWZCj0xt6qjq5mbuMs8r3Vduwvztvxjkb3/sTupvBaagZWJsoa/vtUrQj9OCdenspTUk0RN0pv48Gc36me/L4VxmrcUZWvXW7TfJFTNV+RlCVvygpV3JEvY05elEtXX7+yFKFsZh7oFzsmm3474DlfwhISqryMvK3YXq/7eaqG7uE4J1T1s+MvguJdxg5T22ldJ2IoKH8KSQVdYLOz+l2c5d00br5LQDwvmJRFjv1EQtj/iO0K+SsIz/ZIjgzm7KBy1x+KsW1SrhIZzvWNaGTdOCvVKaAQb+6p6qV/lapZwfzy8Pl18ae9i3RLue5z0Lk/NY91n8VUSht0C7Qp+eIxhtPrFaXWlG6evknAdBydll8RH5mGwepNefvsHE81/eJWE9+xp4sbgoDE7DkrX26rThXQSUWqVMNtof6q+ukaWUDrmK3VKGKhhuVXFUbZ2/KvBPWxF8Rmpy656BGSPj0d1a6Mi1yChPTozEJ9iTPLZsz1NLMdQJ2Jbu7q8SMJLYkKn+KjNP+1u9OtnnRIaVigW7+qw4t+X0Nxdb0v3s5TuFtYsoeGO/avSof4hds0SGqb3eV442tzo+dMSWuHA3ruVMOimZZfKv3sygvHn6cunsGfdWkiTduPQ4qD5o48SD5z31K0j+ORdpLnMdOLpejhvz4ebnXfHRiH7D1W/UvtdppskTpLcEQ8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAL/oP5BU3wQ/BxT8AAAAASUVORK5CYII=" />
                    <!--[if mso]>
                    </td>
                    </tr>
                    </table>
                    <![endif]-->

                    <div style="margin: 4%;">
                      <p style="margin: 1em 0;">This is a test email. You can see that the text is cut off on the left when viewed on Outlook office 365(Windows) This is a test email. You can see that the text is cut off on the left when viewed on Outlook office 365(Windows) This is a test email. You can see that the text is cut off on the left when viewed on Outlook office 365(Windows) This is a test email. You can see that the text is cut off on the left when viewed on Outlook office 365(Windows) This is a test email. You can see that the text is cut off on the left when viewed on Outlook office 365(Windows)</p>
                    </div>
                  </td>
                </tr>
              </tbody>
            </table>
          </td>
        </tr>
      </table>
      <!--[if mso]></td></tr></table></center><![endif]-->
    </td>
  </tr>
</table>

It's supposed to look like this:它应该是这样的: 在此处输入图片说明

It looks fine on most email clients but when viewed in Outlook windows, it looks like this:它在大多数电子邮件客户端上看起来不错,但在 Outlook 窗口中查看时,它看起来像这样: 在此处输入图片说明

It looks like some extra padding is added around the image and the margin on the text also does not seem to work either.看起来在图像周围添加了一些额外的填充,并且文本上的边距似乎也不起作用。 Does anyone have any idea on how to fix this?有没有人知道如何解决这个问题?

Actualy I have another solution...其实我有另一个解决方案......

Change the padding on the <td> to margin on the <table> .<td>上的内边距更改为<table>上的边距。 Looks like that works.看起来这有效。

As to why it works, I'm not too sure yet...至于它为什么起作用,我还不太确定......

<!--[if mso]>
    <table align="left" border="0" cellpadding="0" cellspacing="0" style="width: 30%;margin-right: 20px" width="165">
    <tr>
    <td>
    <![endif]-->
        <img align="left" style="width: 30%; margin-right: 4%;" width="165" src="https://dummyimage.com/165x165/000/fff&text=test" />
    <!--[if mso]>
    </td>
    </tr>
    </table>
<![endif]-->
    ```

This layout does not appear fixable.此布局似乎无法修复。 What Outlook is doing is an attempt to 'float' the image over the div, but it clearly does not quite work. Outlook 正在做的是尝试在 div 上“浮动”图像,但它显然不起作用。

屏幕截图显示图像漂浮在 div 上

This article suggests another problem with this layout in that links may not be clickable when next to an image in a text block (as opposed to a separate table cell, for example): https://help.activecampaign.com/hc/en-us/articles/115001444310-Common-email-display-issues-with-Outlook --so test that aspect out too.本文提出了此布局的另一个问题,即当链接在文本块中的图像旁边时可能无法点击(例如,与单独的表格单元格相反): https : //help.activecampaign.com/hc/en -us/articles/115001444310-Common-email-display-issues-with-Outlook --所以也测试一下。

IMHO, best to put it in its own table cell.恕我直言,最好把它放在自己的表格单元格中。 Divs were never well supported. Div 从来没有得到很好的支持。

It looks like this is coming from the additional ghost table you have around the image.看起来这来自图像周围的附加幻影表。

Removing that solves the issue, but then you need to add some spacing.删除它可以解决问题,但是您需要添加一些间距。

For that you could use an hspace="" attribute on the image to give the margin.为此,您可以在图像上使用hspace=""属性来提供边距。

<p style="margin: 1em 0;">
    <img align="left" style="width: 30%; margin-right: 4%;" hspace="20" width="165" src="https://dummyimage.com/165x165/000/fff&text=test" />This is a test email. You can see that the text is cut off on the left when viewed on Outlook office 365(Windows) This is a test email. You can see that the text is cut off on the left when viewed on Outlook office 365(Windows) This is a test email. You can see that the text is cut off on the left when viewed on Outlook office 365(Windows) This is a test email. You can see that the text is cut off on the left when viewed on Outlook office 365(Windows) This is a test email. You can see that the text is cut off on the left when viewed on Outlook office 365(Windows)</p>

Although that will apply to both left and right.虽然这将适用于左右。

Not a full solution but it's a start maybe.不是一个完整的解决方案,但它可能是一个开始。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM