【发布时间】:2023-04-03 21:52:01
【问题描述】:
我正在构建一封电子邮件,其中每个月将有 3 张图片加载促销优惠。有些月份可能只有 2 个优惠,而代替第 3 张图片的想法是只保存一个 1x1 spacer.gif,以便非开发人员可以更新促销图片。
问题是,如果我没有为每个图像设置特定的高度,当替换 spacer.gif 时,浏览器会将其显示为一个巨大的间隙,基本上高度与宽度相同。
有谁知道我该如何解决这个问题,所以没有这么大的差距,但我不必在那里锁定高度?
以下是相关代码:
<table width="700" align="center" bgcolor="#000000" cellpadding="0" cellspacing="0" border="0" style="min-width:700px">
<tbody>
<tr>
<td><img src="images/spacer.gif" width="40" height="1" border="0" style="display:block; outline:none; text-decoration:none; -ms-interpolation-mode: bicubic;"/></td>
<td>
<table width="620" align="center" bgcolor="#000000" cellpadding="0" cellspacing="0" border="0" style="min-width:620px">
<tbody>
<tr>
<td>
<!-- Offer 1 -->
<a href="" title="Offer" target="_blank"><img src="images/cm_spof_01.gif" width="620" alt="Offer" border="0" style="display:block; outline:none; text-decoration:none; -ms-interpolation-mode: bicubic; font-size:16px; color: #f1f1f1; font-family:arial, sans-serif; height:auto;" /></a>
<!-- Offer 2 -->
<a href="" title="Offer" target="_blank"><img src="images/cm_spof_02.gif" width="620" alt="Offer" border="0" style="display:block; outline:none; text-decoration:none; -ms-interpolation-mode: bicubic; font-size:16px; color: #f1f1f1; font-family:arial, sans-serif; height:auto;" /></a>
<!-- Offer 3 -->
<a href="" title="Offer" target="_blank" style="height:auto;"><img src="images/cm_spof_03.gif" width="620" alt="Offer" border="0" style="display:block; outline:none; text-decoration:none; -ms-interpolation-mode: bicubic; font-size:16px; color: #f1f1f1; font-family:arial, sans-serif; height:auto;" /></a>
</td>
</tr>
</tbody>
</table>
</td>
<td><img src="images/spacer.gif" width="40" height="1" border="0" style="display:block; outline:none; text-decoration:none; -ms-interpolation-mode: bicubic;"/></td>
</tr>
</tbody>
</table>
【问题讨论】: