现在有一个进度条,进度条中间有一串文字,当我的进度条覆盖了文字之后,文字要去进度条反色,怎么实现?
Sunny-117 opened this issue · 1 comments
Sunny-117 commented
现在有一个进度条,进度条中间有一串文字,当我的进度条覆盖了文字之后,文字要去进度条反色,怎么实现?
huccct commented
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
.progress-bar {
position: relative;
width: 200px;
height: 20px;
background-color: #f1f1f1;
}
.progress {
position: absolute;
top: 0;
left: 0;
width: 50%;
height: 100%;
background-color: #4caf50;
}
.text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: #4caf50;
mix-blend-mode: difference;
}
</style>
</head>
<body>
<div class="progress-bar">
<div class="progress"></div>
<div class="text">Progress</div>
</div>
</body>
</html>