Html 电子邮件模板的跨客户端浮动

Html 电子邮件模板的跨客户端浮动,html,css,email,responsive-design,Html,Css,Email,Responsive Design,我正在创建一个电子邮件模板。我想要的是三个盒子的常规浮动: 简化HTML: <center> <div style="width: 100%; max-width: 480px; border-collapse: collapse; margin:0; padding:0; border-spacing: 0;" cellpadding="0" cellspacing="0"> <div

我正在创建一个电子邮件模板。我想要的是三个盒子的常规浮动:


简化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>


这在iOS和android客户端上运行得非常好。我只是不知道如何使这个浮动和宽度在outlook中工作(它不需要响应,但我应该正确显示桌面视图)

查看一下,您将看到Outlook中不支持浮动。创建HTML电子邮件时,最好的计划是使用嵌套表,尽管你的直觉告诉你这是一个多么糟糕的想法。

看看,你会发现Outlook中不支持浮动。创建HTML电子邮件时,最好的计划是使用嵌套表,尽管你的直觉告诉你这是一个多么糟糕的想法。

看看,你会发现Outlook中不支持浮动。创建HTML电子邮件时,最好的计划是使用嵌套表,尽管你的直觉告诉你这是一个多么糟糕的想法。

看看,你会发现Outlook中不支持浮动。创建HTML电子邮件时,最好的计划是使用嵌套的表,尽管你的直觉告诉你这是一个多么糟糕的想法。

对于表,技巧是打开/关闭
显示:块
元素上执行code>

这应该让你开始:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title></title>
  <style type="text/css">
    #outlook a {padding:0;}
    body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;} /* force default font sizes */
    .ExternalClass {width:100%;} .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} /* Hotmail */
    a:active, a:visited, a[href^="tel"], a[href^="sms"] { text-decoration: none; color: #000001 !important; pointer-events: auto; cursor: default;}
    table td {border-collapse: collapse;}

    @media screen and (max-width: 600px) {
        td[class="two-third"], td[class="third-container"] {
            width:100%;
            display:block;
        }

        td[class="third"] {
            width:50% !important;
            display:inline-block !important;
        }
    }

  </style>
</head>
<body style="margin: 0px; padding: 0px; background-color: #FFFFFF;" bgcolor="#FFFFFF"><table bgcolor="#252525" width="100%" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td><table width="600" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td valign="top" style="padding-top:30px; padding-bottom:30px;">

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="left" valign="top" class="two-third" width="66.66%" height="60px" bgcolor="#FF0000">&nbsp;
    </td>
    <td align="left" valign="top" class="third-container" width="33.33%" height="60px">
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td class="third" width="100%" height="30px" bgcolor="#008800" style="display:block;">&nbsp;
          </td>
          <td class="third" width="100%" height="30px" bgcolor="#0000FF" style="display:block;">&nbsp;
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>

</td></tr></table></td></tr></table></body></html>

#outlook a{填充:0;}
正文{宽度:100%!重要;-webkit文本大小调整:100%;-ms文本大小调整:100%;边距:0;填充:0;}/*强制默认字体大小*/
.ExternalClass{宽度:100%;}.ExternalClass、.ExternalClass p、.ExternalClass span、.ExternalClass字体、.ExternalClass td、.ExternalClass div{行高:100%;}/*Hotmail*/
a:活动,a:访问,a[href^=“tel”],a[href^=“sms”]{文本装饰:无;颜色:#000001!重要;指针事件:自动;光标:默认;}
表td{边框折叠:折叠;}
@媒体屏幕和屏幕(最大宽度:600px){
td[class=“two third”],td[class=“third container”]{
宽度:100%;
显示:块;
}
td[class=“third”]{
宽度:50%!重要;
显示:内联块!重要;
}
}

对于表格,窍门是打开/关闭
显示:块
元素上执行code>

这应该让你开始:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title></title>
  <style type="text/css">
    #outlook a {padding:0;}
    body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;} /* force default font sizes */
    .ExternalClass {width:100%;} .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} /* Hotmail */
    a:active, a:visited, a[href^="tel"], a[href^="sms"] { text-decoration: none; color: #000001 !important; pointer-events: auto; cursor: default;}
    table td {border-collapse: collapse;}

    @media screen and (max-width: 600px) {
        td[class="two-third"], td[class="third-container"] {
            width:100%;
            display:block;
        }

        td[class="third"] {
            width:50% !important;
            display:inline-block !important;
        }
    }

  </style>
</head>
<body style="margin: 0px; padding: 0px; background-color: #FFFFFF;" bgcolor="#FFFFFF"><table bgcolor="#252525" width="100%" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td><table width="600" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td valign="top" style="padding-top:30px; padding-bottom:30px;">

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="left" valign="top" class="two-third" width="66.66%" height="60px" bgcolor="#FF0000">&nbsp;
    </td>
    <td align="left" valign="top" class="third-container" width="33.33%" height="60px">
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td class="third" width="100%" height="30px" bgcolor="#008800" style="display:block;">&nbsp;
          </td>
          <td class="third" width="100%" height="30px" bgcolor="#0000FF" style="display:block;">&nbsp;
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>

</td></tr></table></td></tr></table></body></html>

#outlook a{填充:0;}
正文{宽度:100%!重要;-webkit文本大小调整:100%;-ms文本大小调整:100%;边距:0;填充:0;}/*强制默认字体大小*/
.ExternalClass{宽度:100%;}.ExternalClass、.ExternalClass p、.ExternalClass span、.ExternalClass字体、.ExternalClass td、.ExternalClass div{行高:100%;}/*Hotmail*/
a:活动,a:访问,a[href^=“tel”],a[href^=“sms”]{文本装饰:无;颜色:#000001!重要;指针事件:自动;光标:默认;}
表td{边框折叠:折叠;}
@媒体屏幕和屏幕(最大宽度:600px){
td[class=“two third”],td[class=“third container”]{
宽度:100%;
显示:块;
}
td[class=“third”]{
宽度:50%!重要;
显示:内联块!重要;
}
}

对于表格,窍门是打开/关闭
显示:块
元素上执行code>

这应该让你开始:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title></title>
  <style type="text/css">
    #outlook a {padding:0;}
    body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;} /* force default font sizes */
    .ExternalClass {width:100%;} .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} /* Hotmail */
    a:active, a:visited, a[href^="tel"], a[href^="sms"] { text-decoration: none; color: #000001 !important; pointer-events: auto; cursor: default;}
    table td {border-collapse: collapse;}

    @media screen and (max-width: 600px) {
        td[class="two-third"], td[class="third-container"] {
            width:100%;
            display:block;
        }

        td[class="third"] {
            width:50% !important;
            display:inline-block !important;
        }
    }

  </style>
</head>
<body style="margin: 0px; padding: 0px; background-color: #FFFFFF;" bgcolor="#FFFFFF"><table bgcolor="#252525" width="100%" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td><table width="600" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td valign="top" style="padding-top:30px; padding-bottom:30px;">

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="left" valign="top" class="two-third" width="66.66%" height="60px" bgcolor="#FF0000">&nbsp;
    </td>
    <td align="left" valign="top" class="third-container" width="33.33%" height="60px">
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td class="third" width="100%" height="30px" bgcolor="#008800" style="display:block;">&nbsp;
          </td>
          <td class="third" width="100%" height="30px" bgcolor="#0000FF" style="display:block;">&nbsp;
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>

</td></tr></table></td></tr></table></body></html>

#outlook a{填充:0;}
正文{宽度:100%!重要;-webkit文本大小调整:100%;-ms文本大小调整:100%;边距:0;填充:0;}/*强制默认字体大小*/
.ExternalClass{宽度:100%;}.ExternalClass、.ExternalClass p、.ExternalClass span、.ExternalClass字体、.ExternalClass td、.ExternalClass div{行高:100%;}/*Hotmail*/
a:活动,a:访问,a[href^=“tel”],a[href^=“sms”]{文本装饰:无;颜色:#000001!重要;指针事件:自动;光标:默认;}
表td{边框折叠:折叠;}
@媒体屏幕和屏幕(最大宽度:600px){
td[class=“two third”],td[class=“third container”]{
宽度:100%;
显示:块;
}
td[class=“third”]{
宽度:50%!重要;
显示:内联块!重要;
}
}

对于表格,窍门是打开/关闭
显示:块
元素上执行code>

这应该让你开始:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title></title>
  <style type="text/css">
    #outlook a {padding:0;}
    body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;} /* force default font sizes */
    .ExternalClass {width:100%;} .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} /* Hotmail */
    a:active, a:visited, a[href^="tel"], a[href^="sms"] { text-decoration: none; color: #000001 !important; pointer-events: auto; cursor: default;}
    table td {border-collapse: collapse;}

    @media screen and (max-width: 600px) {
        td[class="two-third"], td[class="third-container"] {
            width:100%;
            display:block;
        }

        td[class="third"] {
            width:50% !important;
            display:inline-block !important;
        }
    }

  </style>
</head>
<body style="margin: 0px; padding: 0px; background-color: #FFFFFF;" bgcolor="#FFFFFF"><table bgcolor="#252525" width="100%" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td><table width="600" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td valign="top" style="padding-top:30px; padding-bottom:30px;">

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="left" valign="top" class="two-third" width="66.66%" height="60px" bgcolor="#FF0000">&nbsp;
    </td>
    <td align="left" valign="top" class="third-container" width="33.33%" height="60px">
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td class="third" width="100%" height="30px" bgcolor="#008800" style="display:block;">&nbsp;
          </td>
          <td class="third" width="100%" height="30px" bgcolor="#0000FF" style="display:block;">&nbsp;
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>

</td></tr></table></td></tr></table></body></html>

#outlook a{填充:0;}
正文{宽度:100%!重要;-webkit文本大小调整:100%;-ms文本大小调整:100%;边距:0;填充:0;}/*强制默认字体大小*/
.ExternalClass{宽度:100%;}.ExternalClass、.ExternalClass p、.ExternalClass span、.ExternalClass字体、.ExternalClass td、.ExternalClass div{行高:100%;}/*Hotmail*/
a:活动,a:访问,a[href^=“tel”],a[href^=“sms”]{文本装饰:无;颜色:#000001!重要;指针事件:自动;光标:默认;}
表td{边框折叠:折叠;}
@媒体屏幕和屏幕(最大宽度:600px){
td[class=“two third”],td[class=“third container”]{
宽度:100%;
显示:块;
}
td[class=“third”]{
宽度:50%!重要;
显示:内联块!重要;
}
}

使用表格且仅使用表格。编写跨电子邮件客户端兼容的代码非常具有挑战性。您需要进行一些研究,以确定Outlook是否支持媒体查询。对于这类事情,有很多好的资源。请使用表格来布局电子邮件,样式是非常不可靠的。另外,当表格打开时