电子邮件正文的内联 CSS - 可以获得 nowrap
我正在将内联样式格式化的表格发送到电子邮件正文以发送报告。
我遇到的唯一问题是限制表格的大小。无论我尝试什么,我都无法将文本换行到表格内。这些表格只是扩展到其中最长的东西的长度。
我已经做了几件不同的事情,如果我渲染到页面,这些事情都可以工作,但似乎没有什么能让 Outlook 将文本包装在单元格中。
例如,即使使用容器 div,这些组合也不起作用:
width:1000px;
table-layout:fixed;
word-wrap:break-word;
这是一个示例(页面上很好 - 当在 Outlook 2007 中打开的 HTML 电子邮件正文不会换行 - 表格宽度很大):
<table style="margin-top:5px;width:1000px;table-layout:fixed;word-wrap:break-word;border-collapse: collapse;background-color: #dfe1e4;">
<tr>
<th nowrap="true" style="text-align:center; font-size:14px;border: 1px solid #A69F9F;padding-right:10px;padding-left:10px;background-color: #42669a;color:#f0f8ff;">Description</th>
</tr>
<tr>
<td style="word-wrap:break-word;text-align:left;padding-left:5px;padding-right:15px;border: 1px solid #A69F9F;">
asdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd22222222222222222!
22222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasd
<br>asdfasdfasdf asdf asdf asdf asdf asd fasd fasdf a
<br>asdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd22asdfasd2222222222222222222222222222222222222asdfasdfasd
<br>asdfasdfasdf asdf asdf asdf asdf asd fasd fasdf a
</td>
</tr>
</table>
感谢您的帮助
I'm sending inline styles formatted tables to email bodies for sending out reports.
The only problem I have is restricting the size of the table. No matter what I've tried, I can't get text to wrap inside a table. The tables just expand to the length of the longest thing in them.
I've done several different things that all work if I render to a page, but nothing seems to get outlook to wrap text in cells.
For example, no combination of these, even using container divs works:
width:1000px;
table-layout:fixed;
word-wrap:break-word;
here's a sample (fine on page - when the body of an HTML email opened in Outlook 2007 will not wrap - table goes to a massive width):
<table style="margin-top:5px;width:1000px;table-layout:fixed;word-wrap:break-word;border-collapse: collapse;background-color: #dfe1e4;">
<tr>
<th nowrap="true" style="text-align:center; font-size:14px;border: 1px solid #A69F9F;padding-right:10px;padding-left:10px;background-color: #42669a;color:#f0f8ff;">Description</th>
</tr>
<tr>
<td style="word-wrap:break-word;text-align:left;padding-left:5px;padding-right:15px;border: 1px solid #A69F9F;">
asdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd22222222222222222!
22222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasd
<br>asdfasdfasdf asdf asdf asdf asdf asd fasd fasdf a
<br>asdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd2222222222222222222222222222222222222asdfasdfasdasdfasdfasdfasd22asdfasd2222222222222222222222222222222222222asdfasdfasd
<br>asdfasdfasdf asdf asdf asdf asdf asd fasd fasdf a
</td>
</tr>
</table>
Thanks for any help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Outlook 不支持。
It's not supported in Outlook.
以下组合适用于 Gmail 和 Thunderbird 11:
以上和以下内容均不适用于 Outlook 2010:
但是,Microsoft 的人员意识到他们的电子邮件客户端的弱点,因此他们提供了一个按钮来在 Outlook 2010 中查看 HTML 电子邮件。浏览器。
The following combination works in Gmail and Thunderbird 11:
None of the above and below works in Outlook 2010:
However, the guys at Microsoft are aware of their e-mail client's weaknesses, so they provided a button to view HTML e-mails in the browser.