问题描述
Related Topic: How to write a:hover in inline CSS?
我需要创建一个HTML电子邮件新闻快讯.所有样式均应为内联.(根据 - http://www.campaignmonitor.com/css/并非所有电子邮件客户端都可以在HEAD标签中识别STYLE标签.但他们都喜欢内联样式.)
I need to create an HTML Email News Letters. All styles should be inline. (According to –http://www.campaignmonitor.com/css/Not all email clients recognize STYLE tag with in the HEAD tag. but they all prefer inline styles.)
我的问题:设计师想要深色背景颜色+白色链接,所以我使用-
My Problem:The designer wants a dark background color + white links, so I use -
<a href="http://www.mySite.com" target="_blank">
<span style="color: #ffffff;" >ici</span>
</a>
但是默认的访问的颜色"是深色的.
but the default "visited color" is dark.
还有另一种方法可以更改访问的颜色"吗?
Is there another way to change the "visited color" ?
谢谢
阿塔拉(Atara)
P.S.我还尝试了解密的BODY链接vlink属性.没用.
P.S. I also tried the decrypted BODY link, vlink attributes. did not work.
推荐答案
首先,祝您好运!HTML电子邮件始终处于1996年的技术水平.
First off, good luck! HTML email is stuck firmly at 1996 tech levels.
如果您实际上不需要使用单独的访问过的"颜色,可以尝试做的一件事是在跨度上添加!important.
One thing to attempt if you don't actually need a separate "visited" colour is to add an !important on the span.
例如,您的邮件客户端可能在其样式表中具有以下内容:
For example, your mail client may have something like this in their style sheet:
a:visited * { color: #000 !important; }
在这种情况下,它将覆盖您的内联样式.
In which case that will override your inline style.
因此,请尝试将跨度更改为:
So, try changing your span to:
<a href="http://www.example.com" target="_blank">
<span style="color: #ffffff !important;" >ici</span>
</a>
再次将其覆盖.
在Chrome中进行的快速测试表明, a:visited * {... ... important}
确实覆盖了内联样式,但是将!important
添加回了跨度很好.
A quick test in Chrome shows that the a:visited * { ... !important}
does override the inline style, but adding the !important
back to the span works fine.
2017更新
CampaignMonitor CSS指南现在似乎建议在头部使用< style>
元素,而不是内联所有样式.根据其他答案,这似乎提供了与最新版本的Outlook的最佳兼容性.
The CampaignMonitor CSS guide now seems to recommend using a <style>
element in the head, rather than inlining all styles. Based on other answers this seems to provide the best compatibility with recent version of Outlook.
这篇关于如何编写内联CSS中的a:visit?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!