电子邮件正文的内联 CSS - 可以获得 nowrap

发布于 2024-11-19 18:51:30 字数 2537 浏览 2 评论 0原文

我正在将内联样式格式化的表格发送到电子邮件正文以发送报告。

我遇到的唯一问题是限制表格的大小。无论我尝试什么,我都无法将文本换行到表格内。这些表格只是扩展到其中最长的东西的长度。

我已经做了几件不同的事情,如果我渲染到页面,这些事情都可以工作,但似乎没有什么能让 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

属性 2024-11-26 18:51:30

Outlook 不支持

It's not supported in Outlook.

冷︶言冷语的世界 2024-11-26 18:51:30

以下组合适用于 Gmail 和 Thunderbird 11:

<td style="max-width: 570px; word-wrap: break-word;">

以上和以下内容均不适用于 Outlook 2010:

<table style="table-layout: fixed;">

<table style="table-layout: fixed; width: 570px;">

<div style="overflow: auto;">

<td width="570">`

但是,Microsoft 的人员意识到他们的电子邮件客户端的弱点,因此他们提供了一个按钮来在 Outlook 2010 中查看 HTML 电子邮件。浏览器。

The following combination works in Gmail and Thunderbird 11:

<td style="max-width: 570px; word-wrap: break-word;">

None of the above and below works in Outlook 2010:

<table style="table-layout: fixed;">

<table style="table-layout: fixed; width: 570px;">

<div style="overflow: auto;">

<td width="570">`

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文