获取默认选择颜色? [英] Get default selection color?
本文介绍了获取默认选择颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以 更改 CSS选择颜色,但是如何获取浏览器/OS默认选择,以便可以在其他地方使用它?
I can change the CSS selection color, but how can I get the browser/OS default selection so that I can use it elsewhere?
例如在Ubuntu + Chrome上,文本以橙色突出显示.
e.g. on Ubuntu+Chrome text is highlighted in orange.
当我将鼠标悬停在<li>
上时,我想将相同的样式应用于<li>
.
I want to apply this same style to an <li>
when I hover over it with my mouse.
推荐答案
在CSS2规范中,定义了一些color关键字,但现在已弃用.但是它们仍然应该可以正常工作:
In the CSS2 specs some color keywords are defined but are now deprecated. Yet they should still work just fine:
.selected {
background: Highlight;
color: HighlightText;
}
<p>Lorem ipsum with some <span class="selected">selected text</span></p>
这篇关于获取默认选择颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文