gpt4 book ai didi

html - 时事通讯中忽略了 z-index

转载 作者:太空宇宙 更新时间:2023-11-04 13:38:15 25 4
gpt4 key购买 nike

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Thank you for subscribing to our newsletter!</title>

<style>
img.img {
z-index: -1;
position: absolute;
float:left;
}

.content {
position: relative;
z-index: 5;
}
</style>

</head>
<body>

<div style="width: 750px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
<img class="img" src="email.png" />

<div class="content">
<h1>Text<small>app</small></h1>

</div>
</div>
</body>
</html>

例如,当我将此时事通讯发送到 gmail 时,z-index 会被忽略。我想要的是 img 上的文字。但它将首先呈现图像,然后呈现文本。

基本上 z-index 被忽略了。这可以解决,还是我不能使用 z-index?

最佳答案

Update: This list has been moved to here: Best Practices & Considerations when writing HTML Emails

您不应使用 z-index、div、position 或 float。基本上,您处理 html 电子邮件的整个方法都是错误的。 HTML 电子邮件与 HTML 网页版不同。以下是一些资源:

其中一些信息中的一小部分在技术上并非 100% 正确(html 电子邮件确实是一门魔法),但它们会让您达到 99% 的正确率。

其他支持指南:

您需要使用 VML让背景图片也能在 Outlook 中工作。以下是一些 VML 链接:

您应该始终在 html-email 中内联您的 CSS。以下是 CSS 内联工具列表的链接:

关于html - 时事通讯中忽略了 z-index,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19780614/

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