我正在制作一个带有背景色的盒子,上面有很多内容,因为我必须改变所有与背景色相对的文本颜色,我现在使用的是filter:invert(98%),问题是它工作正常,但是其他图像和图标也被倒置了。
主事
现在,我只想选择带有css文本的元素,因为我正在使用wanted处理块,所以我对js没有太多的控制,所以需要css解决方案。
注意到,在实际项目中,主元素中有许多元素,具有不同的名称。
下面是一个示例代码
.main {
background:black;
}
.main > * {
filter:invert(80%);
}<div class="main">
<div class"text1">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets conta
</div>
<hr>
<div class"another_text">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets conta
</div>
</div>
发布于 2021-10-27 12:04:35
很简单,您可以用这种方式编写css,也可以编写.main{背景:
span{
color:white;
padding:4%;
background:#000000ad
}<div class="test"><span>Hello World</span></div>
}
https://stackoverflow.com/questions/69738140
复制相似问题