将图像添加到html链接属性

时间:2018-08-19 15:22:41

标签: javascript php html css ajax

我有下面的html代码在灯箱中打开,并且可以正常显示标题,图像和页脚。

<a href="example.png" data-footer="The Caption of the Image" data-title="A random title"></a>

我需要在数据标题处显示徽标。你能帮忙吗?

1 个答案:

答案 0 :(得分:1)

我自己找到了答案。如果对其他人有帮助,则只需发布即可。

<a href="example.png" data-footer="The Caption of the Image" data-title="<img src='imgage.png'>"></a>

在上面,我已将<img>标签放在数据标题中,就像您链接到图像一样。