简体   繁体   English

我如何在sendgrid中将电子邮件正文的内容居中

[英]How can i center the content of email body in sendgrid

I am creating an email template for newsletters using send grid, I have designed it and when I send the test email, it always does not fit in the email body as shown in the below image False Image , can anyone help me how can i centered the content of the newsletter in the email body? 我正在使用发送网格为新闻稿创建电子邮件模板,已经设计好了,并且在发送测试电子邮件时,它始终不适合电子邮件正文,如下图所示False Image ,有人可以帮助我如何居中吗电子邮件正文中新闻通讯的内容?

Edit 1: The problem seems to be in outlook only 编辑1:问题似乎仅在前景中

<style type="text/css">
    body {
      min-width: 100%;
      margin: 0;
      padding: 0;
      -webkit-font-smoothing: anyialiased;
      font-family: Trebuchet MS;
    }
    span {
      color:#808080;
      font-size:12px;
    }
    img {
      display: inline-block;
      max-width: 100%;
      max-height: 100%;
    }
    table {
        border-collapse: collapse;
        }

  </style>

<!--Main Container-->
<table border="" cellpadding="0" cellspacing="0" width="100%" class="wrapper">
<tbody>
  <tr>
    <td valign="top" width="600">
        <!--First Table-->
                <table border="0" cellpadding="0" cellspacing="0" class="devicewidth">
                    <tbody>
                        <tr>
                            <td valign="top">
                              <!--Content-->
                            </td>
                            <td valign="top">
                              <!--Content-->
                            </td>
                            <td valign="top">
                              <!--Content-->
                            </td>
                            <td valign="top">
                              <!--Content-->
                            </td>
                            <td valign="top">
                              <!--Content-->
                            </td>
                            <td valign="top">
                              <!--Content-->
                            </td>
                      </tr>
                  </tbody>
                </table>
    </td>
  </tr>
</tbody>
</table>
<!--End of Main Container-->

False image 虚假图片

Pretty sure it should be useable for all newsletter/template-systems (I use Mailchimp myself). 相当确定它应该可用于所有新闻通讯/模板系统(我自己使用Mailchimp)。 You're code is basically missing a 'vertical center'. 您的代码基本上缺少“垂直中心”。

Hope the below snippet explains! 希望下面的代码片段能解释!

 <table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="backgroundTable" style="background-color:red;height:200px;"> <tr> <!-- THIS <td> element needs align center!! --> <td align="center" valign="top" > <table border="0" cellpadding="0" cellspacing="0" width="200" class="templateContainer" style="background-color:white;height:100%;"> <tr> <td> content goes here </td> </tr> </table> </td> </tr> </table> 

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

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