HTML 电子邮件中的图像问题

发布于 2024-09-26 07:34:26 字数 725 浏览 4 评论 0原文

我在构建 HTML 电子邮件时遇到困难。我目前已按以下顺序将整个电子邮件转换为 8 行表:

  1. 标头(图像)
  2. 日期字段
  3. 内容 字段内容
  4. 基础(圆角底部图像)
  5. 页脚顶部(圆角顶部图像)
  6. 页脚
  7. 页脚基础(圆角底部图像)

您可以看,其中四个字段中有一个图像。我对表格的布局非常严格,使其宽 550 像素,图像本身宽 550 像素,并且我在表格上使用边框折叠来消除字段边缘的出现。

我遇到的问题是,所有没有图像的字段都会伸出几个额外的像素,当我使用圆形底部和顶部时,这有点破坏了布局。我简直无法理解它为什么这样做。

图像是根据 标签添加的,我认为正在发生的事情是它在字段边缘和图像之间放置了一个间距,并且表格的其余部分取决于最大的宽度将其他宽度推出几个像素。我正在努力寻找解决方案,我尝试了很多不同的方法,例如在图像和表格上减去边距。有人可以为此提供任何解决方案吗?

下图展示了这种“步进”,虽然很小,但在导出到 Outlook 后,它似乎会增加一倍。图像从“Hydref 2010”行上方开始 -

alt text

更新:我使用了 cellspacing 和 cellpadding 命令并将它们减少到0 修复了浏览器中的显示,但在 Outlook 中是相同的

I'm having difficulty with building a HTML email. I currently have converted my entire email to an 8 row table in the below order:

  1. Header (image)
  2. Date Field
  3. Content Field
  4. Content Base (rounded bottom image)
  5. Footer top (rounded top image)
  6. Footer
  7. Footer Base (rounded bottom image)

As you can see, four of these fields have an image in them. I've been very strict with the layout of my table, making it 550px wide, the images themselves are 550px wide and I use border-collapse on the table to remove the appearence of field edges.

The problem I'm having is that all the fields without images in them stick out an extra couple of pixels, which as I'm using rounded bottoms and tops it kinda ruins the layout. I simple can't fathom why it's doing this.

The images are added as per the <img> tag and what I THINK is happening is that it's putting a spacing between the edge of the field and the image and as the rest of the table is dependent on the width of the largest one it's pushing the others out a couple of pixels. I am struggling to find a solution to this, I've tried lots of different things such as minus margins on the images and tables. Can anybody offer any solutions to this?

The image below demonstrates this "stepping" and although minor, upon exporting to outlook it appears to double. The image starts above the line "Hydref 2010" -

alt text

UPDATE: I used the cellspacing and cellpadding commands and reduced them to 0 which fixed the display in a browser, but in Outlook, it's the same

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

同尘 2024-10-03 07:34:26

HTML 电子邮件总是有点“fuuuuuuuuuuuuuuuuuuuuuuuu”,让我感到泄气。

您已经采取了正确的方法来使用表格,并且您遇到的问题是我以前见过的问题,但我一生都不记得我是如何解决它的。

您是否尝试过将列压缩为一行标记:

<td>
    <img>
</td>

IE 和 Word中的

<td><img></td>

空白对于渲染空格来说非常糟糕。

如果失败,您总是可以拆分列,这样标题两侧就有一个间隔符,主图像上有一个列跨度?

HTML Emails are always a bit "fuuuuuuuuuuuuuuuuuuuuuuuu", and leave me feeling deflated.

You have taken the right approach to use tables, and the problem you are having is one I have seen before, but for the life of my I can't remember how I fixed it.

Have you tried condensing your columns into one row of markup:

<td>
    <img>
</td>

into

<td><img></td>

IE and word are terrible for rending whitespace.

If that fails, you could always split your columns, so you have a spacer either side of the title and a col-span on the main images?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文