html - 如何在 HTML 电子邮件代码中将文本放在图像上?

标签 html email debugging

我已经尝试了一切方法,用我当前的 HTML 代码在图像上显示一些文本,但没有成功。

无论我做什么,文本总是出现在整个页面的底部,而不是图像上。

我看过很多关于 SO 的帖子,但它们对我不起作用。

以下是我解决此问题并继续前进的众多尝试之一。

我做错了什么以及如何解决它?

这是我的 HTML 代码:

 <body width="100%" bgcolor="#f4f8f1">
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
        <tbody>
        <tr>
            <td align="center">
                <table border="0" cellspacing="0" cellpadding="0">
                    <tbody>
                    <tr>
                        <td class="width-320" style="margin: 0 auto;" width="600">
                            <table border="0" cellspacing="0" cellpadding="0">
                                <tbody>
                                <tr>
                                    <td class="width-320 header-welcome" width="600">
                                        <a href="#">
                                            <img class="hide" style="display: block;" src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/Solid_blue.svg/225px-Solid_blue.svg.png" alt="some text" width="1200" height="1000" border="0" />
                                            <p>This is always appearing on the bottom of the page!</p>
                                        </a>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </td>
                    </tr>
                </tbody>
            </table>
        </td>
    </tr>
    </tbody>
    </table>
    </body>

最佳答案

使用position:absoluteleft:0 right:0也使用z-index来显示图像上方的文字 希望这有帮助!

<body width="100%" bgcolor="#f4f8f1">
  <table border="0" width="100%" cellspacing="0" cellpadding="0">
    <tbody>
      <tr>
        <td align="center">
          <table border="0" cellspacing="0" cellpadding="0">
            <tbody>
              <tr>
                <td class="width-320" style="margin: 0 auto;" width="600">
                  <table border="0" cellspacing="0" cellpadding="0">
                    <tbody>
                      <tr>
                        <td class="width-320 header-welcome" width="600">
                          <img class="hide" style="position: absolute; top: 0; left: 0; z-index:-1;" src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/Solid_blue.svg/225px-Solid_blue.svg.png" alt="some text" width="1200" height="1000" border="0" />
                          <p>This is always appearing on the bottom of the page!</p>
                          </a>
                        </td>
                      </tr>
                    </tbody>
                  </table>
                </td>
              </tr>
            </tbody>
          </table>
        </td>
      </tr>
    </tbody>
  </table>
</body>

关于html - 如何在 HTML 电子邮件代码中将文本放在图像上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57417422/

相关文章:

html - 如何将 css 星号选择器 * 限制为一个类和所有后代?

java - 在 Java 中禁用 Outlook 电子邮件转发

java - 如何使用调试器添加监视表达式功能在 Eclipse 中监视空指针?

node.js - 在闭包内部使用 require 时无法在函数内部设置断点

javascript - html 5 canvas - 获取图像的颜色,然后使用该颜色更改像素

jquery - 当我距底部 250 像素(为了论证起见)时,如何使页面上出现一个与底部对齐的栏?

javascript - 使用 jQuery 向按钮添加 Action

linux - shell 脚本电子邮件格式/条件返工

python - 如何使用 Python 发送带有 .csv 附件的电子邮件

debugging - lldb-错误 : invalid thread #i