因此,为了覆盖浏览器的默认选择颜色,通过:: selection伪元素进行文本选择。但对我来说,白色作为选择背景颜色似乎被禁止使用灰色,不透明的颜色。Webkit:Css文本选择样式不能使背景变白?
::selection { color: black; background: white; }
::-moz-selection { color: black; background: white; }
body {
background: black;
color: white;
}
So selecting me is supposed to invert the text and background colors. But the selected text background color is not white, but grey.
为什么这个不创建一个完美的白色背景?相反,它显示了一个灰色的背景(#989898)
也可参阅https://jsfiddle.net/duk3/hzodm1sh/
你明白这个结果是什么浏览器? – chiapa
Chrome和Safari发生这种情况 - 目前版本仍然存在 – Romainpetit