我需要一个 CSS 样式,当背景为红色时文本颜色为白色,背景为白色时文本颜色为黑色。
我的红色背景有以下颜色:#d6002e
我将这个 CSS 添加到我的文本中:
mix-blend-mode: difference;
color: #29FBFF; // Inverted color of my red
现在看起来像这样:
我的文本得到了反色的背景,这不是我想要的。
最佳答案
我觉得这应该可以解决问题
.my-red-bg {
background: #d6002e;
color: white
}
.my-black-bg {
background: black;
color: white
}
https://stackoverflow.com/questions/69581974/
相关文章:
next.js - 如何在 Next.js 中排除单个路由中的尾部斜线?
google-cloud-platform - 将 PHP crypt MD5 密码导入 Googl
javascript - 无法从 'localStorage' 读取 'Window' 属性 : A
swiftui - 如何在 iOS 15 中使用 SwiftUI 在特定 View 中隐藏 TabB
node.js - SassError : Can't find stylesheet to imp
javascript - 如何将 HTMLElement 转换为 JSX.Element