gpt4 book ai didi

html - 电子邮件 HTML 签名在 Web 客户端上添加空白 HTML 元素,导致布局中断

转载 作者:搜寻专家 更新时间:2023-10-31 08:32:04 25 4
gpt4 key购买 nike

我已经尝试解决这个问题几个小时了,但我似乎找不到问题所在。

我有这个 HTML 电子邮件签名,它必须在低分辨率设备上正确包装。

这是一个模型,展示了它在大屏幕设备上的外观: enter image description here

这是它在小屏幕设备上的外观模型: enter image description here

这是标记:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
</head>

<body>
<table width="100%">
<tr>
<td>

<!-- TEXT CELL -->
<table align=left width=160>
<tr>
<td>
<p>
<span style='font-size:12.0pt;font-family:"Times New Roman","serif"; mso-fareast-font-family:"Times New Roman"'>sep</span>
</p>
</td>
</tr>
</table>

<!-- TEXT CELL -->
<table align=left width=160>
<tr>
<td>
<p>
<span style='font-size:12.0pt;font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman"'>ult</span>
</p>
</td>
</tr>
</table>

<!-- TEXT CELL -->
<table align=left width=160>
<tr>
<td>
<p>
<span style='font-size:12.0pt;font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman"'>tur</span>
</p>
</td>
</tr>
</table>

<!-- TEXT CELL -->
<table align=left width=160>
<tr>
<td>
<p>
<span style='font-size:12.0pt;font-family:"Times New Roman","serif";
mso-fareast-font-family:"Times New Roman"'>ura</span>
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

问题出在网络客户端上。出于某种原因,这 4 个表格中的每一个旁边总是附加了一个额外的 HTML 元素: enter image description here

结果如下:

MS Outlook 2007(正确显示): enter image description here

Apple GMail 客户端(正确显示和包装,因为它是小分辨率屏幕): enter image description here

Outlook web(有一个额外的 HTML 元素破坏了布局,图片中有详细信息): enter image description here

GMail 网络(在某种程度上类似于 Outlook 网络): enter image description here

我还想提一下,我用 Litmus 测试了这些,一切看起来都不错。我不确定为什么在这些比方说“现实世界”的情况下情况会有所不同。

可能跟我放HTML签名的过程有关:

  1. 打开包含签名的 HTML 页面
  2. 选择该页面内的所有内容 (ctrl+A)
  3. 复制所有内容(ctrl+C)
  4. 打开微软 Outlook 2007
  5. 转到工具 -> 选项 -> 邮件格式 -> 签名
  6. 新建签名 -> 将内容粘贴到文本区域 -> 保存新建的签名。

最佳答案

我非常确信您所要求的无法在 Outlook '07 的签名中完成。

这是因为 Outlook '07/'10/'13 使用 Microsoft Word 引擎并在发送后添加了自己的垃圾邮件(p msoNormal 标签)。因为是在send之后添加的,所以不能使用inline CSS。在 html 电子邮件设计中,设计人员通常会在样式标签中添加样式,以将这些不需要的标签归零,以期 Outlook 执行此操作。这对您不起作用,因为您仅使用签名。您可以尝试包括 <style>标记在签名 html 中,但我怀疑它是否有效。

我必须模仿这种行为的最佳建议是 &nbsp; .非常 hack 的方式,但如果从 Outlook '07 发送,它可能是“ float ”的唯一选项。示例:

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
Text&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Text&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Text&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Text&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td>
</tr>
</table>

类似这样的东西也可以工作,(绝对更整洁)但我还没有测试过:

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<span style="width:150px;">Text 1</span>
<span style="width:150px;">Text 2</span>
<span style="width:150px;">Text 3</span>
<span style="width:150px;">Text 4</span>
</td>
</tr>
</table>

关于html - 电子邮件 HTML 签名在 Web 客户端上添加空白 HTML 元素,导致布局中断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22305870/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com