html - gmail 电子邮件模板 : how to get table right on mobile in portrait?

标签 html css email gmail email-templates

所以,我正在尝试制作一个带有表格的电子邮件模板。

我在正文标签下有下表

  <table style="padding-top:0px; max-width: 650px;" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#ffffff">
<tbody>
  <tr>
    <td  height="10" style="width: 650px;">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tbody width="100%">
          <tr width="100%">
            <td width="2.5%">&nbsp;</td>
            <td width="22%" style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: bold;">AAAA AAAA</td>
            <td width="40%" style="text-indent: 4%; font-family: Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: bold;">BBBB</td>
            <td width="22%" align="center" style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: bold;">CCC</td>
            <td width="13%" style="text-indent: 4.5%; font-family: Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: bold;">DDDDD</td>
          </tr>
        </tbody>
      </table>
    </td>
  </tr>
</tbody>

它在 Outlook 中看起来正是我想要的方式(桌面、移动纵向、移动横向)。它在桌面和移动环境中的 gmail 中看起来都不错。

但是如果你在 gmail 中用手机竖屏打开它,td 会非常集中在左侧。

有人知道为什么吗?如果重要的话,我正在 Nexus 5 手机上的 gmail 应用程序中进行测试。

最佳答案

试试这个:

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="25%" style="padding-left:3%; font-family: Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: bold;">AAAA AAAA</td>
    <td width="40%" style="padding-left: 4.5%; font-family: Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: bold;">BBBB</td>
    <td width="22%" align="center" style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: bold;">CCC</td>
    <td width="13%" style="padding-left: 4.5%; font-family: Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: bold;">DDDDD</td>
  </tr>
</table>

不确定 text-indent 是否有效,但填充可以。如果您想要最大宽度的流体布局,请将其包裹在 this fluid template example

关于html - gmail 电子邮件模板 : how to get table right on mobile in portrait?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23272966/

相关文章:

Outlook 不支持 HTML 边距

php - 将邮件拆分为单独的邮件

javascript - 具有可滚动div的等高布局

jquery - 带有颜色框的平滑 Div 滚动不起作用

css - 变换 : scaleX() seems to change element's height

css - 如何修复在 Chrome 中再次加载图像

html - 在页面中心对齐画廊

html - 如果我单击 Angular 中的类,则隐藏 div

javascript - slider 与 html 中 slider 后放置的小部件和内容发生冲突

PHP html 电子邮件,使用 html 模板