在来自 javascript 的电子邮件中的图像上叠加文本

问题描述 投票:0回答:1

我有一个提交电子邮件联系信息和消息的表单。我正在尝试用 JavaScript 格式化电子邮件并提交发送。该消息被插入到 javascript 中的 html 中,然后作为电子邮件正文发送。
html 是一张表 - 一个 tr 设置了其中的图像,我试图将消息覆盖在特定位置(盒子)。我的代码如下。结果是消息打印在电子邮件中,然后图像出现 - 根本没有覆盖。 整个 HTML 是在 JavaScript 中组装的字符串,并作为电子邮件正文传递。所有样式(css)都是内联完成的。

显示了代码以及获得的结果。

html: code for the table row where the message is expected to overlay the image

结果:需要将文本放入白框中。text prints above the image, not over it.

javascript image html-email
1个回答
0
投票

如果你想将文本覆盖在图像上,那么你犯了一个小错误,对于

元素,你忘记了 style=""。

代码在这里:

<tr>
    <td valign="top" align="center" style="font-family: 'Ink Free', Arial, sans-serf; font-size: 16px">
        <div class="main">
            <p style="position:absolute; inline-size: 70px; top: 50px; left:280px; text-align:center; color:#000; font-size:14px; font-weight:bold; padding:1px; z-index:99;">
                Test to see if the issue is the text
            </p>
            <img class="picture" src="https://i.postimg.cc/zD28H9DF/Test-image.png" alt=" ">
        </div>
    </td>
</tr>
© www.soinside.com 2019 - 2024. All rights reserved.