繁体   English   中英

需要 CSS 选择器建议

[英]CSS selector suggestion needed

我正在制作一个带有背景颜色的盒子,上面有很多内容,因为我必须更改与背景颜色相反的盒子内所有文本的文本颜色我使用了filter:invert(98%)现在问题是它正在工作很好,但也会使其他图像和图标倒置

主要的事

现在我只想选择带有 css 文本的元素,因为我正在使用 wp react for blocks 我对 js 没有太多控制,所以那件事需要 css 解决方案

请注意,在实际项目中,main 元素中有很多不同名称的元素

这是下面的示例代码

 .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>

很简单,你也可以这样写 css .main{ background:

 span{ color:white; padding:4%; background:#000000ad }
 <div class="test"><span>Hello World</span></div>

}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM