gpt4 book ai didi

html - 当图像为 DIV 背景图像时,使图像在电子邮件 HTML 中可点击

转载 作者:可可西里 更新时间:2023-11-01 13:29:29 25 4
gpt4 key购买 nike

如果图像设置为背景图像 URL,如何使图像在 HTML 电子邮件中可点击?

通常,我只是将 DIV 包装在“a href”中,但我不确定这是否适用于电子邮件客户端?

图像是背景图像(与 img 相对),以便对其进行裁剪和居中。

<table width="230"  cellpadding="0" cellspacing="0" align="left" bgcolor="#EEEEEE">
<tr>
<td width="15" bgcolor="red">&nbsp;</td>
<td width="200" bgcolor="959595" align="left" style="padding: 0px;">
<div style = "height:200px;width:200px;background-image:url('http://www.thisiscolossal.com/wp-content/uploads/2013/01/snow.jpg');background-position: center center;">
</div>
</td>
<td width="15" bgcolor="red">&nbsp;</td>
</tr>
</table>

最佳答案

在要使其可点击的 div 内,执行以下操作

<a href="/destination" style="display:block; width:100%; height:100%;">&nbsp;</a>

这将使链接成为整个 div 的大小。

请记住,不同的电子邮件客户端对不同的 CSS 规则有不同的支持。实际上,将图像包含在正文中而不是在 CSS 中可能会更好。

以下是电子邮件客户端对 CSS 支持的一些引用:
https://www.campaignmonitor.com/css/

关于html - 当图像为 DIV 背景图像时,使图像在电子邮件 HTML 中可点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32300805/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com