CSS3 ::selection 选择器
最后更新于:2022-03-26 21:35:45
CSS3 ::selection 选择器
完整CSS选择器参考手册
实例
将选定的文本红色:
::selection
{
color:#ff0000;
}
::-moz-selection
{
color:#ff0000;
}
尝试一下 »
定义和用法
::selection选择器匹配元素中被用户选中或处于高亮状态的部分。
::selection只可以应用于少数的CSS属性:color, background, cursor,和outline。
浏览器支持





E9+, Opera, Google Chrome和Safari支持::selection选择器。
Firefox 通过其私有属性 ::-moz-selection 支持 。
完整CSS选择器参考手册