-webkit-link是否是与该颜色相关的任何html元素或css属性的有效颜色?
在我的一个应用程序中,我注意到Chrome通过以下规则自动将链接颜色设置为颜色 -webkit-link:
On one of my applications I noticed Chrome was automatically setting link colors as the color "-webkit-link" via this rule:
/* Not set by my CSS stylesheet */
a:-webkit-any-link {
color: -webkit-link;
text-decoration: underline;
cursor: auto;
}
对于我来说,记住默认的链接颜色-webkit-更加容易链接,而不是十六进制代码。
It is much easier for me to remember a default link color as -webkit-link than a hex code.
我尝试设置 p
标记和 div
标记,这似乎在Codepen上可以正常工作。
I tried setting the color of text wrapped in a p
tag and a div
tag and this seemed to work fine on Codepen.
div, p { color: -webkit-link; }
-webkit-color是否是与颜色相关的有效颜色? (我可以测试所有可能的颜色有效但没有时间的情况)。例如,此规则是否将给出链接蓝色边框颜色?
Is "-webkit-color" a valid color for wherever a color is relevant? (I could test every possible circumstance for which color is valid but I don't have time). For example, would this rule give a "link blue" border color?
div { border: 2px solid -webkit-link; }
还是此规则设置了带有链接蓝色的线性渐变?
or this rule set a linear-gradient with "link blue"?
div { background-image: linear-gradient(135deg, red 60%, -webkit-link 60%); }
还是此规则设置了一个带有链接蓝色颜色的盒子阴影?
or this rule set a box-shadow with a "link blue" color?
div { box-shadow: inset 2px 2px 2px 4px -webkit-link; }
以及无休止的其他使用颜色的东西?
and endless others which use color?
否, -webkit-link
不是有效的颜色。
尽管它可以在任何可以使用颜色的地方正常运行,但它没有任何标准,Apple或Blink引擎的任何维护者都没有义务使其保持正常工作。无法保证。
While it does work anywhere you can use a color, it is not in any standard, and neither Apple nor any of the maintainers of the Blink engine have any obligation to keep it working. There's no guarantee.
此外,它不能在其他浏览器中使用。对于Firefox,有 -moz-hyperlinkText
,但适用同样的免责声明。
In addition, it doesn't work in other browsers. For Firefox, there's -moz-hyperlinkText
, but the same disclaimers apply.
(MDN具有一页,其中描述了Mozilla的颜色,但似乎没有是Webkit的类似官方页面。请警告。)
(MDN has a page where the Mozilla colors are described, but there doesn't seem to be a similar official page for Webkit. Let that be a warning.)