【问题标题】:HTML email table buttonsHTML 电子邮件表格按钮
【发布时间】:2016-10-27 05:53:26
【问题描述】:

我一直在尝试将我们的电子邮件从使用一堆图像更新为只使用代码,但我在使用表格时遇到了问题。我似乎无法让 's 像我需要的那样狭窄。我想要的只是让它们彼此靠近并左对齐。我以前从未使用过表格,但我阅读了它们,一切似乎都是正确的,但没有任何效果。关于我需要编辑的内容有什么建议吗? PS 这将在 Outlook 上经常看到,因此这是一个重要因素。

http://codepen.io/Mdadedesign/pen/qavwkg

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->

<tr style='mso-yfti-irow:4;mso-yfti-lastrow:yes; background-color:pink; width:300px'>


          <td width="90" style="background-color:lightblue;">
            <table width="90" style="float:left;">
              <tr>
                <td>
                  <table border="0" align="center" cellpadding="0" cellspacing="0" style="margin:0 auto;">
                    <tbody>
                    <tr>
                      <td align="center">
                        <table border="0" cellpadding="0" cellspacing="0" style="margin:0 auto;">
                          <tr>
                            <td align="left" bgcolor="#075aa0" width="90" style="-moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; padding: 5px;width: 90px;display: block;text-decoration: none;text-align: center;font-weight: bold;font-size: 11.5px;font-family: sans-serif;color: #ffffff;border: 1px solid red;line-height:15px;">
                              <a href="http://premierdisability.com/" style="text-decoration:none;color:#fff;">
                                Android App
                              </a>
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
            </table>
          </td>


          <td width="70" style="background-color:cornsilk;">
            <table width="70" style="float:left;">
              <tr>
                <td>
                  <table border="0" align="center" cellpadding="0" cellspacing="0" style="margin:0 auto;">
                    <tbody>
                    <tr>
                      <td align="center">
                        <table border="0" cellpadding="0" cellspacing="0" style="margin:0 auto;">
                          <tr>
                            <td align="center" bgcolor="#075aa0" width="70" style="-moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; padding: 5px;width: 90px;display: block;text-decoration: none;text-align: center;font-weight: bold;font-size: 11.5px;font-family: sans-serif;color: #ffffff;border: 1px solid red;line-height:15px;">
                              <a href="http://premierdisability.com/" style="text-decoration:none;color:#fff;">
                                Apple App
                              </a>
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
            </table>
          </td>


          <td width="70" style="background-color:lightblue;">
            <table width="70" style="float:left;">
              <tr>
                <td>
                  <table border="0" align="center" cellpadding="0" cellspacing="0" style="margin:0 auto;">
                    <tbody>
                    <tr>
                      <td align="center">
                        <table border="0" cellpadding="0" cellspacing="0" style="margin:0 auto;">
                          <tr>
                            <td align="left" bgcolor="#075aa0" width="90" style="-moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; padding: 5px;width: 90px;display: block;text-decoration: none;text-align: center;font-weight: bold;font-size: 11.5px;font-family: sans-serif;color: #ffffff;border: 1px solid red;line-height:15px;">
                              <a href="http://premierdisability.com/" style="text-decoration:none;color:#fff;">
                                Refer A Friend
                              </a>
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
            </table>
          </td>


                  </tr>

【问题讨论】:

    标签: html email outlook html-table width


    【解决方案1】:

    你说的是底部的三个按钮,“Android App”、“Apple App”和“推荐朋友”,对吧?

    如果您查看您拥有的样式,您会在表格上设置一个宽度,并在每个按钮的样式中设置一个以 px 为单位的宽度。实际上,总宽度并没有那么多,但是您可以将第一个从 90px 更改为 70px,将第二个从 90px 更改为 60px,最后一个从 90px 更改为 80px。如果你想让它们比这更小,你必须把它们放在一起,或者减小文本和可点击区域的大小。

    【讨论】:

    • 是的,我说的是这三个按钮。但是按钮的大小将基本保持不变。我唯一担心的是它们之间的空间。以交替的浅色背景突出显示。那么 不能比 短吗?或者这仅仅是样式的原因?
    • 啊哈。对不起,我误解了你的要求。这将通过在按钮内的每个 &lt;table&gt;-element 上使用 border-collapse: collapse; 来解决。因此,对于每个&lt;table&gt;,您要么添加上述内容,要么添加style="border-collapse: collapse;",如果尚未指定样式。
    • 感谢 JFJ 的快速回复。我只是尝试了一下,它有点帮助,但它真正所做的只是在单元格的所有侧面移除了少量空间。所以现在它在顶部、左侧和底部齐平,但右侧的空间仍然存在。我更新了之前链接的代码笔。我什至在“推荐朋友”的所有元素中添加了折叠,只是为了看看这是否也能起到作用。
    猜你喜欢
    • 1970-01-01
    • 2011-05-27
    • 2011-08-12
    • 2013-02-20
    • 2012-06-17
    • 2012-12-10
    • 1970-01-01
    • 1970-01-01
    • 2016-06-06
    相关资源
    最近更新 更多