html - Gmail:大于内联 css 样式中定义的大小的元素

标签 html css gmail html-email

所以我正在编写新闻通讯的 html 代码,并且由于限制而使用内联样式,因此我的“表格布局”被破坏,因为元素的大小大于定义的大小。 我意识到一个定义了 170px 高度的元素,并且在它们内部有一个定义了 170px 高度的标签,那么为什么使用检查我可以看到它有 172px,我认为 Gmail 忽略了一些东西。

我制作了一个 gif 来在检查器中显示这一点:/image/KnXEz.gif

我的 JSfiddle 和我的 html:http://jsfiddle.net/wtkd/ygfn6qka/ (带有马里奥图像的框显示布局中断的位置) 如果您不想在 JSfiddle 中看到:

  <table width="700" align="center" style="background-image: url('http://www.image.test.com/images/bg.jpg'); background-color: #ededed; background-position: center top; background-repeat: no-repeat; margin:0;padding:0;padding: 0; width: 700px; margin: 0 auto;">
<tr width="600" style="border-collapse:collapse;border-spacing:0;">
  <td style="border-collapse:collapse;border-spacing:0;">
    <table width="600" align="center" border="0" cellpadding="0" cellspacing="0" style=
    "border-collapse:collapse;border-spacing:0;">
      <thead width="600" style="border-collapse:collapse;border-spacing:0;">
        <tr width="600"height="150" style="border-collapse:collapse;border-spacing:0;">
          <th width="600" style="border-collapse:collapse;border-spacing:0;">
            <img src="http://www.image.test.com/images/header.png" width="600" height="151">
          </th>
        </tr>
        <tr height="104">
          <th style="height:104px; border-bottom: 5px #ededed solid;">
            <img src="http://www.image.test.com/images/update.png" width="600" height="104">
          </th>
        </tr>
      </thead>
      <tbody width="600">
        <tr height="170">
          <th height="170">
            <a style="height:170px;" href="http://www.test.com/motorola-droid-turbo/65466-moto-maxx-chega-oficialmente-brasil-preco-r-xxxx.htm" target="_blank"><img src="http://www.image.test.com/images/moto-maxx.png" width="600" height="170"></a>
          </th>
        </tr>
        <tr height="180">
          <th height="170">
            <a style="height:170px;" href="http://www.test.com/jogos/65442-explosivo-trailer-gameplay-gta-v-confirma-modo-primeira-pessoa.htm" target="_blank"><img src="http://www.image.test.com/images/gta-v.png" width="600" height="170"></a>
          </th>
        </tr>
        <tr>
          <table width="600" height="340" align="center" border="0" cellpadding="0" cellspacing="0" style=
            "border-collapse:collapse;border-spacing:0;">
            <tr>
              <th height="170" style="height: 170px; width: 200px;border-collapse:collapse;border-spacing:0;">
                <a style="height: 170px; width: 200px;border-collapse:collapse;border-spacing:0;" href="http://www.test.com/moto-x/65400-analise-review-smartphone-motorola-novo-moto-x-2014.htm" target="_blank"><img src="http://www.image.test.com/images/moto-x.png" width="200" height="170"></a>
              </th>
              <th height="170" style="height: 170px; width: 200px;border-collapse:collapse;border-spacing:0;">
                <a style="height: 170px; width: 200px;border-collapse:collapse;border-spacing:0;" href="http://www.test.com/iphone-6/64640-analise-apple-iphone-6-review.htm" target="_blank"><img src="http://www.image.test.com/images/iphone.png" width="200" height="170"></a>
              </th>
              <th rowspan="2" height="340" style="width: 200px; height: 340px;border-collapse:collapse;border-spacing:0;">
                <a style="width: 200px; height: 340px;border-collapse:collapse;border-spacing:0;" href="http://www.test.com/jogos/65339-personagens-super-mario-viram-brindes-mcdonalds-brasileiro.htm" target="_blank"><img src="http://img.elo7.com.br/product/original/62C89A/painel-mario-bros.jpg" width="200" height="340"></a>
              </th>
            </tr>
            <tr width="400" height="170">
              <th height="170" colspan="2" style="border-collapse:collapse;border-spacing:0;">
                <a style="width:400px;height:170px;border-collapse:collapse;border-spacing:0;" href="http://www.test.com/celular/65283-dinossauros-9-celulares-marcaram-epoca.htm" target="_blank"><img src="http://cdn.bgr.com/2013/11/super-mario-3d-world.jpg" width="400" height="170"></a>
              </td>
            </tr>
          </table>
        </tr>
        <tr>
          <table width="700" align="center" border="0" cellpadding="0" cellspacing="0" style=
              "border-collapse:collapse;border-spacing:0;background:#ededed;">
            <tr align="center" height="170" style="border-collapse:collapse;border-spacing:0;">
              <th height="170">
                <a href="http://www.test.com/cinema/65416-30-filmes-2015-voce-querer-ver-cinemas-estreias-lancamentos.htm" target="_blank"><img src="http://www.image.test.com/images/filmes.png" width="600" height="170"></a>
              </th>
            </tr>
            <tr height="180" align="center" style="border-collapse:collapse;border-spacing:0;">
              <td colspan="2" style="width:400px;height:170px;border-collapse:collapse;border-spacing:0;">
                <img src="http://www.image.test.com/images/grupo-nzn.jpg" width="600" height="180">
              </td>
            </tr>
          </table>
        </tr>
      </tbody>
    </table>
  </td>
</tr>

有人可以帮忙解决这个问题吗?

最佳答案

您需要将 display:block; 内联到所有 img 标记中。

关于html - Gmail:大于内联 css 样式中定义的大小的元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26887494/

相关文章:

html - 相对定位设置高度100%

javascript - 使用 javascript 对 html 列表进行排序

html - 如何使用 CSS 显示时间轴

css - 如何在 Slickgrids 中自动换行标题栏

html - 为什么我的 CSS 中的零填充会产生 'false' 边距?

python - 如何在 python 中向 Gmail-API 发送批量请求?

flutter - 无法在 flutter 中使用 URL 启动程序包启动 gmail 应用程序

python - BeautifulSoup : Parsing "Span" element

jquery - div 内的 Multiscroll.js

GMAIL API 在发送时删除了我的 html 属性