html - 为 Gmail 构建电子邮件,我的 <img> 一直设置为隐藏

标签 html css email gmail inline

我正在为我的公司制作电子邮件 HTML 文档

除了要显示的一组图像外,一切都很好。 在 Office 上,它们看起来很好,但在 Gmail 上,它们是隐藏的,当我在检查器中查看 HTML 时,我看到 style="display: none !important; visibility: hidden !important; opacity: 0 !important; background-position: 300 像素 32 像素;"已添加到图像中。

有谁知道这是为什么以及我该如何阻止它。

<table width="100%" cellspacing="0" cellpadding="0" border="0" bgcolor="#ffffff">
      <tr>
        <td width="100%">
            <table width="100%" cellspacing="0" cellpadding="0" border="0" style="border: 1px solid #45b75c;">
               <tr style="border: 1px solid #45b75c">
                  <td align="center" width="155" height="155" style="background-color: #f3f1f1;">
                     <img src="https://www.soccerhubb.com/assets/img/emails/world-cup/advert1.png" width="115" height="115" alt="Advertise to your target audience" line-height="" style="display: block;"/>
                  </td>
                  <td align="center">
                     <p style="text-align: center; font-size: 24px; color: #45b75c;">
                         Advertise to your target audience<br />
                         with intelligent analytics
                     </p>
                   </td>
               </tr>
            </table>
         </td>
     </tr>
<table>

最佳答案

使用 style 标签并通过 display:block 应用样式 !important 在 css 中 !important 关键字用于覆盖所有样式

关于html - 为 Gmail 构建电子邮件,我的 <img> 一直设置为隐藏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24209496/

相关文章:

php - 如何在 Laravel 5.5 中发送多封邮件

javascript - 当在键盘上按下 'enter' 时,CSS 按钮不执行表单

python - 将样式表与 django-widget-tweaks 一起使用?

html - parent 而非祖 parent 的 CSS 百分比定位

javascript - 如何让递归调用的 setTimeout 函数在后台保持事件状态

css - Chrome 中的字体像素化问题 (HTML5/CSS3)

PHPMailer 5.1 在添加超过 1 个收件人时发送重复的电子邮件

php - 用 php 发送邮件不起作用

html - 网格无法正常工作

php - 提交表单时 CSS 填充消失