字体大小未应用于Outlook 2010中的<h2>元素

时间:2016-07-15 20:11:51

标签: css html-email outlook-2010

我已将font-size: 14px !important应用于以下标记中的h2a元素:<h2><a href="#">Content</a></h2>。但是,此标题在Outlook 2010中显示为巨大的(如默认的h2标题)。显然,font-size规则未应用。但为什么呢?

这是我的代码中更完整的部分:

<table style="border-collapse:collapse;border-spacing:0;padding:0;text-align:left;vertical-align:top;width:100%">
   <tr style="padding:0;text-align:left;vertical-align:top">
      <th style="Margin:0;color:#686868;font-family:Helvetica,Arial,sans-serif;font-size:11px;font-weight:400;line-height:1.2;margin:0;padding:0;padding-bottom:0!important;text-align:left">
         <h2 class="small-text-center" style="Margin:0;Margin-bottom:10px;color:#063972!important;font-family:Times New Roman,Georgia,sans-serif!important;font-size:14px!important;font-weight:700!important;line-height:1.2;margin:0;margin-bottom:0!important;padding:0;text-align:left;word-wrap:normal"><a href="http://www.lefigaro.fr" class="supplement_titre" style="Margin:0;color:#063972!important;font-family:Times New Roman,Georgia,sans-serif!important;font-size:14px!important;font-weight:700!important;line-height:1.2;margin:0;padding:0;text-align:left;text-decoration:none">L'opposition projet de loi El Khomri ne faiblit pas</a></h2>
      </th>
   </tr>
</table>

2 个答案:

答案 0 :(得分:1)

如果可能,删除<h2>并仅使用<a href>本身,将所有内联样式放在锚标记中。这将取消Outlook(和任何其他电子邮件客户端)放置默认标记的任何默认样式,例如<h1><h2><p>等。

答案 1 :(得分:0)

由于我无法回复@Ted Goas的回复,这是我的解释。

无论出于何种原因,Outlook都会忽略您在!important标记上设置的样式,即使您添加了<a>,也只是不接受它。

要重复Ted Goas所说的内容,我同意使用标题标签会在Outlook中产生非常意外的结果。

最好的解决方案是在<span>上设置样式,当我们处理它时,也将文本包裹在<table style="border-collapse:collapse;border-spacing:0;padding:0;text-align:left;vertical-align:top;width:100%"> <tr style="padding:0;text-align:left;vertical-align:top"> <th style="Margin:0;color:#063972!important;font-family:Times New Roman,Georgia,sans-serif!important;font-size:14px!important;font-weight:700!important;line-height:1.2;margin:0;padding:0;text-align:left;text-decoration:none"> <a href="http://www.lefigaro.fr" class="supplement_titre" style="Margin:0;color:#063972!important;font-family:Times New Roman,Georgia,sans-serif!important;font-size:14px!important;font-weight:700!important;line-height:1.2;margin:0;padding:0;text-align:left;text-decoration:none"><span style="Margin:0;color:#063972!important;font-family:Times New Roman,Georgia,sans-serif!important;font-size:14px!important;font-weight:700!important;line-height:1.2;margin:0;padding:0;text-align:left;text-decoration:none">L'opposition projet de loi El Khomri ne faiblit pas</span></a> </th> </tr> </table> 标记周围,因为这也解决了Outlook中的颜色问题。

以下是我在Outlook 2010中编辑以解决此问题的代码:

<Button Name="btnGenerateHash"  
        IsEnabled="{Binding VM.IsGenerateButtonEnabled}"
        Command="{Binding GenerateCommand}"
        Content="{Binding VM.GenerateHashButtonLabel}" Width="160"                      
        Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Margin="10" >
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="MouseEnter">
            <i:InvokeCommandAction Command="{Binding HighlightFieldsCommand}" CommandParameter="{Binding Source='generate,enter'}"></i:InvokeCommandAction>
        </i:EventTrigger>
        <i:EventTrigger EventName="MouseLeave">
            <i:InvokeCommandAction Command="{Binding HighlightFieldsCommand}" CommandParameter="{Binding Source='generate,leave'}"></i:InvokeCommandAction>
        </i:EventTrigger>
    </i:Interaction.Triggers>
</Button>

Outlook 2010

Outlook 2010