Webkit:Css文本选择样式不能使背景变白?

Rom*_*tit 7 css webkit styling selection

因此,文本选择可以通过:: selection伪元素进​​行样式化,以覆盖浏览器的默认选择颜色.但对我来说,似乎禁止使用白色作为选择背景颜色,而采用灰色,不透明的颜色.

::selection      { color: black;  background: white; }
::-moz-selection { color: black;  background: white; }

body {
    background: black;
    color: white;
}
Run Code Online (Sandbox Code Playgroud)
So selecting me is supposed to invert the text and background colors. But the selected text background color is not white, but grey.
Run Code Online (Sandbox Code Playgroud)

为什么这不能创造出完美的白色背景?相反,它显示灰色背景(#989898)

Css选择不接受白色背景

另请参阅https://jsfiddle.net/duk3/hzodm1sh/上的这个片段

Rom*_*tit 8

好的,按照这个问题,我找到了答案:

出于某种原因,Chrome强制它是半透明的.但是,您可以通过使用rgba设置背景来解决此问题.我已将alpha值设置为小于1的0.01.

::selection { color: black;  background: rgba(255, 255, 255, 0.996);
; }

body {
    background: black;
    color: white;
}
Run Code Online (Sandbox Code Playgroud)
Selecting me DOES invert the text and background colors. Well, almost, but it looks like perfect white.
Run Code Online (Sandbox Code Playgroud)