【问题标题】:why selection background color changes?为什么选择背景颜色会发生变化?
【发布时间】:2021-02-13 17:44:46
【问题描述】:

我申请了::selection background-color,但是当我使用digital color meter 使用选择颜色进行检查时,它显示了不同的颜色

这是我的代码 https://jsbin.com/voketaqaxu/edit?html,css,js,output

::selection{
  background-color: rgb(78,106,65);

} 

我在选择时应用了background-color: rgb(78,106,65);,但是当我使用数字颜色进行检查时,它告诉我这个rgb(42,70,31) 为什么??

【问题讨论】:

标签: javascript html jquery css flexbox


【解决方案1】:

可能是为了阻止您正在尝试做的事情。

看起来 Chrome 会改变选择的背景颜色不透明度,如果它是 1。你可以通过将不透明度设置为非常接近 1 来作弊,例如

background-color: rgb(78,106,65, .99);

【讨论】:

  • 任何更好的解决方案
  • 在我看来没有别的办法,因为它是基于chrome来更新不透明度的。
  • 在 Firefox 中签入
猜你喜欢
  • 2018-04-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-02-12
  • 2013-07-08
  • 1970-01-01
  • 2020-11-01
相关资源
最近更新 更多