【问题标题】:Hide td in html mail在 html 邮件中隐藏 td
【发布时间】:2023-03-15 14:10:01
【问题描述】:

我想发送一封将在 Outlook 中打开的电子邮件。 在这封邮件中我想隐藏一些空的td

这是我的代码:

<td width=""10%"" style="overflow: hidden;display:none;mso-hide:all;font-size: 0;max-height: 0; line-height: 0;"></td>

我得到的是这样的:

这个td 就像它有 1 像素的高度,但没有隐藏。

编辑:添加完整表格

<table border=1 align=""right""  style=""width: 49.5%;font-family:calibri;font-size:10pt;border-collapse:separate;" +
  @"border: 1px solid black;"">"

   @"<tr><th style=""font-family:calibri;font-size:10pt;background-color:#DDD9C4;"">Localisation</th>" +
                                   @"<th style=""font-family:calibri;font-size:10pt; background-color:#DDD9C4;"">Site</th>" +
                                   @"<th style=""font-family:calibri;font-size:10pt; background-color:#DDD9C4;width : 10%;"">Etat</th>" +
                                   @"<th style=""font-family:calibri;font-size:10pt;background-color:#DDD9C4;"">Commentaire</th> </tr>";

 bodytable = bodytable + "<tr>" +
                                  @"<td  style=""background-color:" + GetLocalisationColor(itemtheme.NomTheme) + @"""  rowspan=" + (itemlocation.Site.Count + 1) + ">" + itemlocation.NomLocalisation + "</td>" +

                                     @"<td  style=""overflow: hidden;display:none;mso-hide:all;font-size: 0;max-height: 0; line-height: 0;""></td>" +
                                               @" <td width=""10%"" style=""overflow: hidden;display:none;mso-hide:all;font-size: 0;max-height: 0; line-height: 0;""></td>" +
                                               @"<td  style=""overflow: hidden;display:none;mso-hide:all;font-size: 0;max-height: 0; line-height: 0;""></td>" +

                             " </tr>";

【问题讨论】:

    标签: c# html email outlook


    【解决方案1】:

    请尝试一下。您应该根据需要在电子邮件模板中使用来更改它

    <table border=1 align="right" style="width:49.5%;font-family:calibri;font-size:10pt;border-collapse:separate;border: 1px solid black;">
       <tr>
          <th style="font-family:calibri;font-size:10pt;background-color:#DDD9C4;">Localisation</th>
          <th style="font-family:calibri;font-size:10pt; background-color:#ddd9c4;">Site</th>
          <th style="font-family:calibri;font-size:10pt; background-color:#ddd9c4;width:10%;">Etat</th>
          <th style="font-family:calibri;font-size:10pt;background-color:#ddd9c4;">Commentaire</th>
      </tr>
    
      <tr>       
          <td style="background-color:red"  rowspan="1"> itemlocation.nomlocalisation </td>
          <td style="overflow:hidden;display:none;mso-hide:all;font-size: 0;max-height:0; line-height:0;"></td>
          <td width="10%" style="overflow:hidden;display:none;mso-hide:all;font-size: 0;max-height:0; line-height:0;"></td>
          <td style="overflow:hidden;display:none;mso-hide:all;font-size: 0;max-height:0; line-height:0;"></td>
      </tr>
    </table>
    

    【讨论】:

    • 你能告诉我你做了什么改变吗?我看不到任何更改(对于 "" 部分,这只是因为它在 c# 代码中,所以你必须用两个引号覆盖 "
    • 在你的代码中有这样的错误。最大高度 0;行高 0;
    • 好吧,但仍然无法正常工作.. td 没有隐藏它只是 1 px 高(或更少)
    • 我在 html 页面上试试这个,它可以工作。可能是您缺少电子邮件模板的内容
    • 问题不在 html 中,而在 Outlook 客户端,(它在 html 中运行良好,仅使用 diplay:none ..但使用 Outlook 客户端时它不会隐藏
    猜你喜欢
    • 1970-01-01
    • 2020-09-22
    • 1970-01-01
    • 2016-10-22
    • 2022-10-06
    • 1970-01-01
    • 1970-01-01
    • 2016-05-29
    • 2021-11-10
    相关资源
    最近更新 更多