html - 电子邮件模板 - float 跨度的水平填充在换行符处被截断

标签 html css email css-float email-templates

我正在努力构建电子邮件模板。使用 span 内联显示一些单词(试图避免 display 属性,因为某些 outlook 版本不支持它)出现 float 问题。

问题案例:包括填充在内的整个跨度不适合当前行,因此文本中断到下一行 - 现在没问题。不幸的是,“左”填充保留在第一行并被“切断”该元素,如您在此屏幕截图中所见。 1

<span style=" line-height:25px; font-family:'Roboto', sans-serif; font-size:11px; background:#EBEBEB; border-radius: 8px;a padding: 3px 10px; margin:0;">
    Vollzeit
</span>
<span>&nbsp;</span>

如何强制填充与文本保持一致并使其也跳到下一行? (这个问题不仅出现在 outlook 上,也出现在其他几个电子邮件客户端上。)

最佳答案

您可以尝试改用表格,因为电子邮件客户端对大量其他标记和样式的支持是出了名的糟糕。 Chris Coyier 在此处有一篇关于响应式电子邮件的好文章 https://css-tricks.com/ideas-behind-responsive-emails/查看他指出的特别围绕 3 列的部分:

You might think: each of those will be a <td>. But no, if that was the case you'd never be able to get them to wrap in the limited CSS world of emails.

它看起来很恶心,但是,以下的一些变体可能会起作用 http://codepen.io/anon/pen/GoyojN

<table class="main-wrapping-table">
    <tr>
        <td>
            <table align="left" style="width: 33.33%">
            </table>
            <table align="left" style="width: 33.33%">
            </table>
            <table align="left" style="width: 33.33%">
            </table>
        </td>
    </tr>
</table>

关于html - 电子邮件模板 - float 跨度的水平填充在换行符处被截断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34902995/

相关文章:

html - 仅在 <div> 的两侧应用投影。可能使用 css3 渐变和边框图像?

html - Div 没有扩展到 float 图像的高度

email - 声明性管道发送电子邮件

html - Chrome 在浏览器高度调整大小时挤压 <img>

javascript - 如何为 React 和非 React 消费者提供解决方案?

html - 垂直居中响应容器内的响应图像

javascript - 如何使这个有效的 Java 脚本更有效率

css - 我们可以将 CSS 关键帧动画限制在一个范围内吗

php - 发送带有附件的自动电子邮件时,有时文件会重复

ASP.NET MVC : How to send an html email using a controller?