css - 在 CSS 中使用 mix-blend-mode 时如何确定文本的颜色?
问题描述
在 CSS 中使用 mix-blend-mode 时如何更改文本的颜色?
这是代码:https ://jsfiddle.net/1nyah2zf/
是)我有的:
我想要的是:
谢谢 !
code
解决方案
我不认为 mix-blend-mode 会是你需要的:
从您的示例中,您可以使用背景附件来执行此操作:
这个想法的例子:
body {
margin: 0;
display: flex;
}
.left {
width: 200px;
height: 200px;
background: green;
}
.right {
width: 200px;
height: 200px;
background: url('https://www.illicoveto.com/wp-content/uploads/sacre-de-birmanie.jpg');
background-size: 200px;
}
.text {
position: absolute;
left: 100px;
top: 70px;
font-size: 50px;
animation-name: animation;
animation-duration: 2s;
animation-delay: 0s;
animation-iteration-count: infinite;
background: linear-gradient(90deg, black 200px, white 200px) fixed;
color: transparent;
background-clip: text;
}
@keyframes animation {
0% {
left: 100px;
}
50% {
left: 140px;
}
100% {
left: 100px;
}
}
<div class="left"></div>
<div class="right"></div>
<div class="text">HELLO!</div>
没有背景附件,然后只移动文本
推荐阅读
- javascript - 通过用字母对替换所有出现的单词来创建新单词
- java - 如何设计享元模式?
- python - Python:将数据导入 Access 表时,除了 pyodbc 或解决方法之外的其他方法
- android - android 应用在 Rxjava2 之上使用 Flow/coroutine
- next.js - Next JS 中的 Font Awesome 6 (beta) 和动态图标名称
- python - cmd控制台在后台运行
- c# - Bot Framework Composer Skill Host Endpoint 401 Unauthorized
- nested - (Wald)比较两个嵌套的 feols/plm 模型的测试
- javascript - 更改其中的变量而不重新定义函数
- java - 如何在 Intellij 上使用 main 方法运行单个 Java 文件?