【发布时间】:2018-07-19 02:04:23
【问题描述】:
我正在尝试创建将通过电子邮件分发的服务台票证模板。通过在线遵循一些关于如何创建在不同设备和电子邮件客户端上看起来不错/一致的动态电子邮件模板的指南,我得到了以下结果:
但是,当电子邮件发送出去时,它变成了这种可怕的创造,似乎不再尊重使用百分比的宽度(右侧失去了填充):
此问题在 Outlook、Gmail 和 iOS 的邮件客户端之间仍然存在。我已经确定某些内容必须被忽略或无法用于我的标题标签中的电子邮件,但无法准确确定问题所在。我将不胜感激任何见解或解决方案来解决这里究竟是什么问题。
编辑:我想提一下我也使用了mailchimp's CSS inliner tool,但它的输出产生了完全相同的结果。我也尝试将style="display: block;" 用于img 样式,但是当这没有解决任何问题时,我只是删除了工单标题中使用的公司图像......问题仍然存在。
附上片段:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
* {
box-sizing: border-box;
}
img {
display: block;
}
html {
font-family: "Lucida Sans", sans-serif;
}
.header {
font-size: 45px;
background-color: #bbbcbc;
width: 75%;
color: #000000;
padding: 15px;
}
.box {
width:75%;
border: 20px solid #bbbcbc;
margin: 0;
}
.case-number {
font-size: 20px;
background-color: #535659;
color: white;
width: 100%;
padding: 10px;
}
.date-opened {
font-size: 20px;
background-color: #bbbcbc;
color: #000000;
width: 100%;
padding: 10px;
}
.body {
font-size: 20px;
background-color: white;
color: black;
width: 100%;
padding: 15px;
}
.ttable th {
width: 20%;
text-align: left;
background-color: #bbbcbc;
border: 1px solid #bbbcbc;
padding: 5px;
margin:0;
}
.ttable td {
width: 60%;
border: 1px solid #bbbcbc;
padding: 5px;
margin:0;
}
.footer {
width: 100%;
background-color: #bbbcbc;
color: black;
text-align: center;
padding-top: 20px;
}
</style>
</head>
<body>
<div class="header">
<img src="" style="display: block;"/>
</div>
<div class="box">
<div class="case-number">Case Number: 123456</div>
<div class="date-opened">Date Opened: 14 June 2018 at 12:00 PM</div>
<div class="body">
You are receiving this email because your case has been updated. Your case details and any updates can be found below this message.
<br></br>
If you wish to post a comment to the case you can simply reply to this email and your case will be updated.
If you would like to include a screenshot or relevant log files you can do so by including them in your reply.
<br></br>
[progress bar goes here]
<br></br>
In order to proceed with your case we will need additional information or clarification on the reported issue.
Please provide the requested information within the next 4 days.
If no response is received during this time we will temporarily archive your case.
Once you are ready to continue with simply reply to one of the case emails.
<br></br>
<div class="ttable">
<table>
<tr>
<th>Subject</th>
<td>TICKET SUBJECT HERE</td>
</tr><tr>
<th>Description</th>
<td>TICKET DESCRIPTION HERE</td>
</tr>
</table>
</div>
</div>
<div class="footer">
</div>
</div>
</body>
</html>
【问题讨论】:
-
您可能希望在电子邮件模板中使用老式的表格布局而不是 DIV+CSS 布局,因为众所周知,电子邮件客户端对现代 CSS 的支持更差,所以规则-不使用基于表格的布局的经验不适用于电子邮件模板。
-
您可能想查看this link,了解在 Gmail 中使用 HTML/CSS 时的一些常见问题
标签: html css html-email