HTML调整电子邮件签名中的图像

时间:2019-01-15 16:37:30

标签: html css email html-email

我已经创建了一个电子邮件签名以供使用。在浏览器中打开HTML文件时,我没有任何问题,但是当我在个人电子邮件中粘贴电子邮件签名并发送电子邮件时,签名中存在的徽标图像会移到右侧...我不知道该如何解决。

在浏览器中校正图像

电子邮件中的图片,描述了问题

HTML

<html>
<body>
  <table cellpadding="0" cellspacing="0" border="0" style="font-size:12px; font-family: Arial; line-height: 17px;" width="430">
    <tr>
      <td valign="top" colspan="2" style="padding-bottom: 10px;">
        <img src="https://uploaddeimagens.com.br/images/001/834/894/original/pic.png?1547564265" />
      </td>
    </tr>
    <tr>
      <td valign="top" style="padding-left: 10px;">
        <p style="font-size:14px; font-weight: bold; color:#464646; margin: 0px; margin-bottom: 10px; padding-bottom: 5px;">
          Company<br/>
          <span style="font-weight: normal; color: #000; ">Role</span>
        </p>
      </td>
    </tr>
    <tr>
      <td colspan="2" style="padding-bottom:10px; padding-left: 10px;">
        <span style="font-weight: bold; color:#464646;">E-mail:</span> aaa@gmail.com<br/>
        <span style="font-weight: bold; color:#464646;">Phone:</span> 1231231231 | <span style="font-weight: bold; color:#464646;">Phone:</span> 2222123123<br/>
        <span style="font-weight: bold; color:#464646;">Fax:</span> 00010102301<br/>
        <img style="width:30px; height:30px;" src="https://img.icons8.com/color/50/000000/domain.png"><img style="width:30px; height:30px;" src="https://img.icons8.com/color/50/000000/facebook.png"><br/>
      </td>
      <td colspan="2">
        <img style="width:110px; height:110px;margin-left:-112px;margin-top:-99px;" src="https://via.placeholder.com/100x100" />
      </td>
    </tr>
    <tr>
      <td valign="top" colspan="2">
        <img style="margin-top:-12px;" src="https://uploaddeimagens.com.br/images/001/834/900/original/pic-2.png?1547564365" />
      </td>
    </tr>
  </table>
</body>
</html>

3 个答案:

答案 0 :(得分:0)

我非常确定这是因为图像与联系信息位于同一行。我认为将图像添加到具有公司和角色的行中(在第二个<tr>标签之间)将解决此问题。

答案 1 :(得分:0)

我喜欢使用拖放编辑器“ react-email-builder”,并获得良好的效果。您可以自行托管它,也可以在unlayer.com-> Demo of the Builder上免费使用它。

Github react-email-builder

这是从react-email-builder重建的代码段版本(应该在所有邮件客户端中都可以使用):

<!doctype html>
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">

    <head>
      <title></title>
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta name="x-apple-disable-message-reformatting">
      <style type="text/css">
        #outlook a {
          padding: 0;
        }
        
        .ReadMsgBody {
          width: 100%;
        }
        
        .ExternalClass {
          width: 100%;
        }
        
        .ExternalClass * {
          line-height: 100%;
        }
        
        body {
          margin: 0;
          padding: 0;
          -webkit-text-size-adjust: 100%;
          -ms-text-size-adjust: 100%;
        }
        
        table,
        td {
          border-collapse: collapse;
          mso-table-lspace: 0pt;
          mso-table-rspace: 0pt;
        }
        
        img {
          border: 0;
          height: auto;
          line-height: 100%;
          outline: none;
          text-decoration: none;
          -ms-interpolation-mode: bicubic;
        }
        
        p,
        ul {
          display: block;
          margin: 0;
        }
        
        @media only screen and (min-width: 480px) {
          .email-col-17 {
            width: 17% !important;
          }
          .email-col-25 {
            width: 25% !important;
          }
          .email-col-33 {
            width: 33% !important;
          }
          .email-col-50 {
            width: 50% !important;
          }
          .email-col-67 {
            width: 67% !important;
          }
          .email-col-100 {
            width: 100% !important;
          }
        }
        
        @media only screen and (max-width: 480px) {
          img.fullwidth {
            max-width: 100% !important;
          }
          .no-stack .email-col-17 {
            width: 17% !important;
          }
          .no-stack .email-col-25 {
            width: 25% !important;
          }
          .no-stack .email-col-33 {
            width: 33% !important;
          }
          .no-stack .email-col-50 {
            width: 50% !important;
          }
          .no-stack .email-col-67 {
            width: 67% !important;
          }
          .no-stack .email-col-100 {
            width: 100% !important;
          }
        }
      </style>

      <!--[if mso]>
    <xml>
      <o:OfficeDocumentSettings>
        <o:AllowPNG/>
        <o:PixelsPerInch>96</o:PixelsPerInch>
      </o:OfficeDocumentSettings>
    </xml>
    <![endif]-->
      <!--[if mso]>
    <style type="text/css">
      ul li {
        list-style:disc inside;
        mso-special-format:bullet;
      }
    </style>
    <![endif]-->
      <!--[if lte mso 11]>
    <style type="text/css">
      .outlook-group-fix {
        width:100% !important;
      }
    </style>
    <![endif]-->

    </head>

    <body id="u_body" class="u_body" width="100%" bgcolor="#ffffff" style="margin: 0; mso-line-height-rule: exactly; background-color: #ffffff;">
      <div style="background-color: #ffffff; font-family: arial,helvetica,sans-serif;">

        <table id="u_row_3" class="u_row" align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="margin: 0; padding: 0">
          <tr>
            <td align="center" valign="top" bgcolor="" style="padding: 0px; background-color: ;">
              <!--[if mso | IE]>
          <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="430" align="center" style="width:430px;"><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;">
          <![endif]-->
              <div style="margin:0px auto;max-width:430px;">
                <table role="presentation" cellpadding="0" cellspacing="0" style="font-size:0px;width:100%;" align="center" border="0">
                  <tbody>
                    <tr>
                      <td style="text-align:center;vertical-align:top;direction:ltr;font-size:0px;" bgcolor="">
                        <!--[if mso | IE]>
                    <table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td style="vertical-align:top;width:430px;">
      <![endif]-->
                        <div id="u_column_4" class="email-col-100 outlook-group-fix u_column" style="vertical-align:top;display:inline-block;direction:ltr;font-size:13px;text-align:left;width:100%;">

                          <table id="u_content_image_1" class="u_content_image" style="font-family:arial,helvetica,sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
                            <tbody>
                              <tr>
                                <td style="overflow-wrap: break-word;padding:0px;font-family:arial,helvetica,sans-serif;" align="left">

                                  <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                    <tr>
                                      <td style="padding-right: 0px; padding-left: 0px;" align="center">

                                        <img align="center" border="0" src="https://unroll-images-production.s3.amazonaws.com/projects/1958/1547577556027-pic.png" alt="Image" title="Image" style="outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;clear: both;display: block !important;border: none;height: auto;float: none;width: 100%;max-width: 430px;"
                                          width="430">

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

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

                        </div>
                        <!--[if mso | IE]>
      </td>
    </tr></table>
                    <![endif]-->
                      </td>
                    </tr>
                  </tbody>
                </table>
              </div>
              <!--[if mso | IE]>
          </td></tr></table>
          <![endif]-->
            </td>
          </tr>
        </table>

        <table id="u_row_2" class="u_row" align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="margin: 0; padding: 0">
          <tr>
            <td align="center" valign="top" bgcolor="" style="padding: 0px; background-color: ;">
              <!--[if mso | IE]>
          <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="430" align="center" style="width:430px;"><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;">
          <![endif]-->
              <div style="margin:0px auto;max-width:430px;">
                <table role="presentation" cellpadding="0" cellspacing="0" style="font-size:0px;width:100%;" align="center" border="0">
                  <tbody>
                    <tr>
                      <td style="text-align:center;vertical-align:top;direction:ltr;font-size:0px;" bgcolor="">
                        <!--[if mso | IE]>
                    <table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td style="vertical-align:top;width:287px;">
      <![endif]-->
                        <div id="u_column_2" class="email-col-67 outlook-group-fix u_column" style="vertical-align:top;display:inline-block;direction:ltr;font-size:13px;text-align:left;width:100%;">

                          <table id="u_content_text_2" class="u_content_text" style="font-family:arial,helvetica,sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
                            <tbody>
                              <tr>
                                <td style="overflow-wrap: break-word;padding:11px 0px 0px;font-family:arial,helvetica,sans-serif;" align="left">

                                  <div style="color: #000; line-height: 140%; text-align: left; word-wrap: break-word;">
                                    <p style="line-height: 140%; font-size: 14px;"><span style="font-size: 18px; line-height: 25.2px;"><strong>Company</strong></span></p>
                                    <p style="line-height: 140%; font-size: 14px;">Role</p>
                                    <p style="line-height: 140%; font-size: 14px;">&nbsp;</p>
                                    <p style="line-height: 140%; font-size: 14px;"><strong>E-mail:</strong> <a href="mailto:aaa@gmail.com">aaa@gmail.com</a><br /><strong>Phone:</strong> 1231231231 | <strong>Phone:</strong> 2222123123<br /><strong>Fax:</strong> 00010102301</p>
                                  </div>

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

                          <table id="u_content_html_1" class="u_content_html" style="font-family:arial,helvetica,sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
                            <tbody>
                              <tr>
                                <td style="overflow-wrap: break-word;padding:0px;font-family:arial,helvetica,sans-serif;" align="left">

                                  <div>
                                    <img style="width:30px; height:30px;" src="https://img.icons8.com/color/50/000000/domain.png"><img style="width:30px; height:30px;" src="https://img.icons8.com/color/50/000000/facebook.png"><br/>
                                  </div>

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

                        </div>
                        <!--[if mso | IE]>
      </td>
    <td style="vertical-align:top;width:143px;">
      <![endif]-->
                        <div id="u_column_3" class="email-col-33 outlook-group-fix u_column" style="vertical-align:top;display:inline-block;direction:ltr;font-size:13px;text-align:left;width:100%;">

                          <table id="u_content_image_3" class="u_content_image" style="font-family:arial,helvetica,sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
                            <tbody>
                              <tr>
                                <td style="overflow-wrap: break-word;padding:20px 10px 10px;font-family:arial,helvetica,sans-serif;" align="left">

                                  <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                    <tr>
                                      <td style="padding-right: 0px; padding-left: 0px;" align="right">

                                        <img align="right" border="0" src="https://via.placeholder.com/100x100" alt="Image" title="Image" style="outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;clear: both;display: block !important;border: none;height: auto;float: none;width: 100%;max-width: 100px;"
                                          width="100">

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

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

                        </div>
                        <!--[if mso | IE]>
      </td>
    </tr></table>
                    <![endif]-->
                      </td>
                    </tr>
                  </tbody>
                </table>
              </div>
              <!--[if mso | IE]>
          </td></tr></table>
          <![endif]-->
            </td>
          </tr>
        </table>

        <table id="u_row_4" class="u_row" align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="margin: 0; padding: 0">
          <tr>
            <td align="center" valign="top" bgcolor="" style="padding: 0px; background-color: ;">
              <!--[if mso | IE]>
          <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="430" align="center" style="width:430px;"><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;">
          <![endif]-->
              <div style="margin:0px auto;max-width:430px;">
                <table role="presentation" cellpadding="0" cellspacing="0" style="font-size:0px;width:100%;" align="center" border="0">
                  <tbody>
                    <tr>
                      <td style="text-align:center;vertical-align:top;direction:ltr;font-size:0px;" bgcolor="">
                        <!--[if mso | IE]>
                    <table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td style="vertical-align:top;width:430px;">
      <![endif]-->
                        <div id="u_column_5" class="email-col-100 outlook-group-fix u_column" style="vertical-align:top;display:inline-block;direction:ltr;font-size:13px;text-align:left;width:100%;">

                          <table id="u_content_image_2" class="u_content_image" style="font-family:arial,helvetica,sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
                            <tbody>
                              <tr>
                                <td style="overflow-wrap: break-word;padding:0px;font-family:arial,helvetica,sans-serif;" align="left">

                                  <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                    <tr>
                                      <td style="padding-right: 0px; padding-left: 0px;" align="center">

                                        <img align="center" border="0" src="https://unroll-images-production.s3.amazonaws.com/projects/1958/1547577562813-pic-2.png" alt="Image" title="Image" style="outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;clear: both;display: block !important;border: none;height: auto;float: none;width: 100%;max-width: 430px;"
                                          width="430">

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

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

                        </div>
                        <!--[if mso | IE]>
      </td>
    </tr></table>
                    <![endif]-->
                      </td>
                    </tr>
                  </tbody>
                </table>
              </div>
              <!--[if mso | IE]>
          </td></tr></table>
          <![endif]-->
            </td>
          </tr>
        </table>

      </div>
    </body>

    </html>

答案 2 :(得分:0)

这将在包括Outlook和Gmail在内的大多数电子邮件客户端中一致地工作。

sort

祝你好运。