如何在Outlook.exe中实现无需表格的健壮双列邮件HTML布局?
兼容Outlook.exe的无表格双列邮件布局方案
我们目前通过表格实现了如下双列邮件布局:将讨论参与者的头像显示在邮件正文左侧,样式类似论坛讨论区。现寻求一种无需表格、简洁且健壮的HTML实现方案,核心要求是必须兼容Outlook.exe。
此前尝试的float布局、多列布局均无法在Outlook中正常生效——Outlook会忽略水平定位规则,将正文文本置于头像下方,而非预期的右侧列中。
失效的float布局代码
<div style="width: 100%; overflow: hidden;"> <div style="float: left; width: 100px;"> <!-- Avatar --> <img src="https://picsum.photos/90" style="width: 100%; height: auto;"> </div> <div style="margin-left: 111px;"> <!-- E-Mail text content --> <p>Here is the remaining content of the email, which is displayed to the right of the avatar, in a virtual column so to speak. This text can be formatted and filled with further content, such as additional paragraphs, lists, images, etc.</p> </div> </div>
失效的多列布局代码
<div style="width: 100%; columns: 2; column-gap: 20px;"> <div style="width: 100px; break-inside: avoid;"> <!-- Avatar --> <img src="https://picsum.photos/90" style="width: 100%; height: auto;"> </div> <div> <!-- E-Mail text content --> <p>Here is the remaining content of the email, which is displayed to the right of the avatar, in a virtual column so to speak. This text can be formatted and filled with further content, such as additional paragraphs, lists, images, etc.</p> </div> </div>
内容的提问来源于stack exchange,提问作者David.P
相关产品推荐
相关产品推荐

