簡體   English   中英

HTML電子郵件模板-Outlook忽略元素的寬度

[英]Html e-mail template - Outlook ignore width of elements

我想問一下,如何強制Outlook尊重元素的寬度?

例如,我在表中有一些代碼:

<tr>
        <td width="100px" style="text-align: center">
        <div style="Margin-left: 20px;Margin-right: 20px;">
  <div class="divider" style="font-size: 2px;line-height: 2px;Margin-left: auto;Margin-right: auto;width: 40px!important;background-color: #ccc;Margin-bottom: 20px;">&nbsp;</div>
</div>
    </td>
    </tr>

分隔線類的寬度為40px,但在Outlook中,div的寬度為100%,為什么?

電子郵件的HTML傾向於純粹依賴於表格,因此您將無法在td使用divs

然后,您需要使用raw width屬性和內聯css來指定單元格寬度:

<td width="40" style="width: 40px;">Cell content</td>

為了真正安全起見,您可以走得更遠,並包括一個透明的1x1像素圖像,然后將其用於強制像元寬度。 例如:

<td width="40" style="width: 40px">
  <img src="blank.gif" width="40" style="width: 40px;" />
</td>

我建議閱讀電子郵件中有關HTML的Campaign Monitor指南

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM