当Firefox失去焦点时,选择将更改颜色 [英] Selection changes color when Firefox loses focus
问题描述
我通过CSS设置选择背景颜色:
:: selection {
background:#cc0000 ;
color:#fff;
}
:: - moz-selection {
background:#cc0000;
color:#fff;
}
在大多数浏览器上,当焦点在其他地方选择颜色将保持不变,例如:
,但在Firefox上不会:
您可以在jsFiddle 此处。
如何让Firefox设置选择颜色在这种情况下?
如何在这种情况下让Firefox设置选择颜色?
不幸的是,似乎没有办法。
$ b $
没有人(包括Mozilla本身)可以肯定地说;这从未指定,而 :: selection
仍然在CSS3规范。我找不到有关 MDN 或错误报告的任何信息 bugzilla.mozilla.org 。但我发现此错误报告自2010年报告以来显然没有解决。
这可以在将来澄清,例如如果 :: selection
在UI 4中返回。
I'm setting the selection background color via CSS:
::selection {
background:#cc0000;
color:#fff;
}
::-moz-selection {
background:#cc0000;
color:#fff;
}
On most browsers when the focus is somewhere else (like an IFrame), the selection color will stay the same, e.g.:
but on Firefox it won't:
You can see this in action on jsFiddle here.
How can I get Firefox to set the selection color in this case? Is this a bug?
How can I get Firefox to set the selection color in this case?
Unfortunately, there doesn't appear to be a way to do so.
Is this a bug?
Nobody (including Mozilla themselves?) can say for sure; this was never specified while ::selection
was still in the CSS3 spec. I can't find any information on MDN or bug reports on bugzilla.mozilla.org on this either. but I did find this bug report, which has apparently been left unresolved since being reported in 2010.
This may be clarified in the future, e.g. if ::selection
returns in UI 4.
这篇关于当Firefox失去焦点时,选择将更改颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!