18910140161

HTML-避免CSS过滤器反转DIV:Selection中的更改-堆栈溢出

顺晟科技

2022-10-18 13:56:57

173

* ::selection {
  background: #000;
  color: #fff;
}
.a, .b {
  background: red;
  color: yellow;
}
.a {
  filter: invert(1);
}
.a::selection {
  filter: invert(1);
}
<代码><;DIV类=' A '>;转换的金额,指定为数字或百分比。100%的值完全反转,而0%的值保持输入不变。0%和100%之间的值是效果的线性乘数。插值的空缺值为0。<;/DIV>;<;br/>;<;DIV类=' B '>;转换的金额,指定为数字或百分比。100%的值完全反转,而0%的值保持输入不变。0%和100%之间的值是效果的线性乘数。插值的空缺值为0。<;/DIV>;

我有两个包含一些文本的DIV.两个DIV都有单独的类。我想在<div class='a'> The amount of the conversion, specified as a number or a percentage. A value of 100% is completely inverted, while a value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the effect. The lacuna value for interpolation is 0. </div> <br/> <div class='b'> The amount of the conversion, specified as a number or a percentage. A value of 100% is completely inverted, while a value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the effect. The lacuna value for interpolation is 0. </div>类中应用filter:invert(1)。同时,::selection颜色不应在<div class='a'> The amount of the conversion, specified as a number or a percentage. A value of 100% is completely inverted, while a value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the effect. The lacuna value for interpolation is 0. </div> <br/> <div class='b'> The amount of the conversion, specified as a number or a percentage. A value of 100% is completely inverted, while a value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the effect. The lacuna value for interpolation is 0. </div>类中反转。我试过上面的代码。但是,它没有起作用。我也尝试了.a :not(::selection)。它也不会起作用。有办法解决这个问题吗?


顺晟科技:

您可以在<div class='a'> The amount of the conversion, specified as a number or a percentage. A value of 100% is completely inverted, while a value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the effect. The lacuna value for interpolation is 0. </div> <br/> <div class='b'> The amount of the conversion, specified as a number or a percentage. A value of 100% is completely inverted, while a value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the effect. The lacuna value for interpolation is 0. </div>中切换所选内容的颜色,以便当该元素的整个内容反转时,您可以再次获得所需的颜色。

.a
<代码><;DIV类=' A '>;转换的金额,指定为数字或百分比。100%的值完全反转,而0%的值保持输入不变。0%和100%之间的值是效果的线性乘数。插值的空缺值为0。<;/DIV>;<;br/>;<;DIV类=' B '>;转换的金额,指定为数字或百分比。100%的值完全反转,而0%的值保持输入不变。0%和100%之间的值是效果的线性乘数。插值的空缺值为0。<;/DIV>;

  • TAG:
相关文章
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航