html - 电子邮件模板的跨客户端 float

标签 html css email responsive-design

我正在创建电子邮件模板。我想要的只是三个盒子的常规 float : enter image description here


简化的 HTML:

        <center>
            <div style="width: 100%; max-width: 480px; border-collapse: collapse; margin:0; padding:0; border-spacing: 0;" cellpadding="0" cellspacing="0">

                <div class="main" align="left" width="300" style="display: block; float: left; width: 300px; background: red; border-collapse: collapse; margin:0; padding:0; border-spacing: 0;" cellpadding="0" cellspacing="0">

                </div>

                <div class="half" align="left" width="180" style="display: block; float: left; width: 180px; height: 100px; background: green; border-collapse: collapse; margin:0; padding:0; border-spacing: 0;" cellpadding="0" cellspacing="0">

                </div>


                <div class="half" align="left" width="180" style="display: block; float: left; width: 180px; height: 100px; background: blue; border-collapse: collapse; margin:0; padding:0; border-spacing: 0;" cellpadding="0" cellspacing="0">

                </div>

            </div>
        </center>

CSS:

@media screen and (max-width: 480px) {
    .main {
        width:100% !important;
    }

    .half {
        width:45% !important;
    }

    .third {
        width:33% !important;
    }

    .third:last-child {
        width:34% !important;
    }
}

这在 iOS 和 android 客户端上运行完美。我只是不知道如何使这个 float 和宽度在 Outlook 中工作(它不需要在那里响应,但我应该正确显示桌面 View )

最佳答案

看看 email standards project您会看到 Outlook 不支持 float 。创建 HTML 电子邮件时,最好的计划是使用嵌套表格,尽管你的直觉告诉你这是一个多么糟糕的想法。

关于html - 电子邮件模板的跨客户端 float ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21991887/

相关文章:

javascript - 使用 .text() 的 jquery 能够更改 Bootstrap 类第一个跨度但不能更改第二个跨度

c# - 有什么方法可以让 .NET 代码在电子邮件到达时运行和处理它们?

javascript - 区分向下滚动和向上滚动

javascript - 使用 HTML5 拖放,有没有办法在保持拖动流的同时从 View 中隐藏元素

html - css绝对输入div位置

php - 没有灰色背景

html - CSS 选择器 : Don't show empty DIV with no background image?

php - 使用 .htaccess 删除 php 扩展

php - 重构 php 联系表单

language-agnostic - GMail 和 POP3 RETR 问题 - 切换到 IMAP?