如果图像设置为背景图像URL,如何使图像在HTML电子邮件中可单击?
通常,我会把div包装成一个“a-ref”,但我不确定这是否适用于电子邮件客户?
图像是一个背景图像(与img相反),以便裁剪并居中。
<table width="230" cellpadding="0" cellspacing="0" align="left" bgcolor="#EEEEEE">
<tr>
<td width="15" bgcolor="red"> </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"> </td>
</tr>
</table>
最佳答案
在要使clickable成为可点击的div
中,执行以下操作
<a href="/destination" style="display:block; width:100%; height:100%;"> </a>
这将使链接成为整个div的大小。
请记住,不同的电子邮件客户端对不同的css规则有不同的支持。您最好将图像实际包含在正文中,而不是css中。
以下是电子邮件客户端对css支持的一些参考:
https://www.campaignmonitor.com/css/