【问题标题】:HTML Newsletter - Links on the same line on iOSHTML Newsletter - iOS 上同一行的链接
【发布时间】:2013-06-13 11:48:44
【问题描述】:

我正在开发一个时事通讯模板,并且我有一个非常基本的多单元页脚,可以在 IE/FF 和 Outlook 中完美呈现。但是当我从 iPhone 或 iPad 阅读电子邮件时,页脚菜单中的链接显示在两行中。谁能帮我理解为什么会发生这种情况以及我如何在 iPhone/iPad 上也能获得想要的结果?

这是我的代码(只是包含页脚的部分):

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body>
<table id="background-table" border="0" cellpadding="0" cellspacing="0" width="100%" style="letter-spacing: -0.01em; border-collapse: collapse; font-family: arial; text-align: left; margin: 0px; padding: 0px; border: 0px;">
<tbody style="margin: 0px; padding: 0px; border: 0px;">
<tr>
<td align="center" bgcolor="#FFFFFF" style="color: #6f6f6f; border: #6f6f6f;">
<!-- block preamble starts -->
<table class="l-preamble" border="0" cellpadding="0" cellspacing="0" width="600" style="letter-spacing: -0.01em; border-collapse: collapse; font-family: arial; text-align: left; margin: 0px; padding: 0px; border: 0px;">
<tbody style="margin: 0px; padding: 0px; border: 0px;">
<tr>
<td class="has-border-bottom-1" height="16" width="600" style="color: #6f6f6f; border-bottom: 1px solid #6f6f6f;"></td>
</tr>
<!-- element preamble-info ends -->
<!-- element preamble-year starts -->
<tr>
<td width='420'>
<table class="small-font" style="letter-spacing: -0.01em; border-collapse: collapse; font-family: arial; text-align: left; font-size: 12px; color: #b2b2b2 !important; text-transform: uppercase; margin: 0px; padding: 0px; border: 0px;">
<tbody style="margin: 0px; padding: 0px; border: 0px;">
<tr>
<td class="fabsize" class='is-last' style="letter-spacing: 0; padding-right: 12px; ">
<font style=' color: #b2b2b2;'>
<a href="http://www.test/fab" target="blank" style="line-height: inherit; margin: 0px; padding: 0px; border: 0px;color: #b2b2b2;">
Responsibles
</a>
</font>
</td>
<td class="fabsize" class='is-last' style="letter-spacing: 0; padding-right: 12px; padding-left: 12px; border-left: 1px solid #b2b2b2;">
<font style=' color: #b2b2b2;'>
<a href="http://www.test/fab" target="blank" style="line-height: inherit; margin: 0px; padding: 0px; border: 0px;color: #b2b2b2;">
Disclaimer
</a>
</font>
</td>
<td class="fabsize" class='is-last' style="letter-spacing: 0; padding-right: 12px; padding-left: 12px; border-left: 1px solid #b2b2b2;">
<font style=' color: #b2b2b2;'>
<a href="http://www.test/fab" target="blank" style="line-height: inherit; margin: 0px; padding: 0px; border: 0px;color: #b2b2b2;">
Feedback
</a>
</font>
</td>
<td class="fabsize" class='is-last' style="letter-spacing: 0; padding-right: 12px; padding-left: 12px; border-left: 1px solid #b2b2b2;">
<font style=' color: #b2b2b2;'>
<a href="http://www.test/fab" target="blank" style="line-height: inherit; margin: 0px; padding: 0px; border: 0px;color: #b2b2b2;">
RSS feeds
</a>
</font>
</td>
</tr>
</tbody>
</table>
</td>
<td width="180" align="right" style="color: #6f6f6f; border: #6f6f6f;">
<table class="small-font" style="letter-spacing: -0.01em; border-collapse: collapse; font-family: arial; text-align: left; font-size: 12px; color: #b2b2b2 !important; text-transform: uppercase; margin: 0px; padding: 0px; border: 0px;">
<tbody style="margin: 0px; padding: 0px; border: 0px;">
<tr>
<td class="is-first" style="color: #6f6f6f;letter-spacing: 0; padding: 0px; border: 0px">
<span style="color: #b2b2b2; line-height: inherit; margin: 0px; padding: 0px; border: 0px;">
&copy; 2013&nbsp;&nbsp;&nbsp;&nbsp;LLLLLVSKI
</span>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</body>
</html>

【问题讨论】:

  • 那是因为它们根本不适合 ipad/iphone 上的一行。
  • 什么页脚?您的代码中没有页脚。
  • 另外,请从您的 html 中删除错误,然后重试。写bgcolor="#FFFFFF" style="color: #6f6f6f;没有充分的理由,也从来没有
  • 您好!好吧,我不明白为什么它不适合一行。我应该改变什么?页面的其余部分正确显示。关于标记中的错误,我正在为时事通讯开发,所以我使用了一个工具来生成标记。由于时事通讯标准相当陈旧,因此 bgcolor 仍然是一个有效的命令。有趣的是它使用不同的颜色值,但我认为这是有原因的。
  • @MrLister bgcolor 是在 html 电子邮件中声明背景颜色的正确方法。 style="color:#6f6f6f;" 是声明文本的最佳方式。法比奥说得对。

标签: iphone css ipad newsletter


【解决方案1】:

您的版权部分转到下一行的原因是因为您浮动(准确地说是对齐)两个相邻的表格。您的主要页脚为 420,版权信息为 180,虽然它们位于 600 像素宽的单元格中,但它们不适合,至少在 iPhone/iPad 上是这样。

我的第一个猜测是因为您没有在表格单元格上声明确切的宽度(责任、免责声明等...),所以它会将您的 480 像素表格推得更宽。

如果您总是希望它们位于同一行,那么拥有一张桌子比使用 align="left" 与并排的桌子调情要容易得多。

从版权表中取出 td 单元格并将其放入另一个单元格中。此外,您不需要电子邮件中的&lt;tbody&gt; 标签,因此也请删除它们。

应该是这样的:

<table width="600" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>
      <font style=' color: #b2b2b2;'>
        <a href="http://www.test/fab" target="blank" style="line-height: inherit; margin: 0px; padding: 0px; border: 0px;color: #b2b2b2;">Responsibles </a>
      </font>
    </td>
    <td>
      <font style=' color: #b2b2b2;'>
        <a href="http://www.test/fab" target="blank" style="line-height: inherit; margin: 0px; padding: 0px; border: 0px;color: #b2b2b2;">Disclaimer </a>
      </font>
    </td>
    <td>
      <font style=' color: #b2b2b2;'>
        <a href="http://www.test/fab" target="blank" style="line-height: inherit; margin: 0px; padding: 0px; border: 0px;color: #b2b2b2;">Feedback </a>
      </font>
    </td>
    <td>
      <font style=' color: #b2b2b2;'>
        <a href="http://www.test/fab" target="blank" style="line-height: inherit; margin: 0px; padding: 0px; border: 0px;color: #b2b2b2;">RSS feeds </a>
      </font>
    </td>
    <td>
    </td>
    <td>
      <font style=' color: #b2b2b2;'>
        <font style="color: #b2b2b2; line-height: inherit; margin: 0px; padding: 0px; border: 0px;">
          &copy; 2013&nbsp;&nbsp;&nbsp;&nbsp;LLLLLVSKI
        </font>
      </font>
    </td>
  </tr>
</table>

【讨论】:

  • Ciao 约翰!非常感谢您的回复。我做了一些测试,是的,现在链接显示在同一行,但需要滑动才能看到整个页脚。可能我的问题描述不够清楚。在我的版本中,换行的是左侧的单个项目(责任、免责声明、反馈、RSS 提要)。但至少整个页脚是可见的,无需滑动。我在这里创建了一个小提琴:jsfiddle.net/FcqNp
  • @Fabbio 能否请您发送一个问题的屏幕截图 - 这将有助于查明问题。
猜你喜欢
  • 2013-06-14
  • 1970-01-01
  • 2013-09-13
  • 2011-05-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-07-14
  • 2015-01-16
相关资源
最近更新 更多