<!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>文字颜色自适应背景颜色</title>
<style>
.title {
mix-blend-mode: difference;
color: #ffffff;
transform: translateX(100%);
transition: all .3s;
}
.gradient {
height: 300px;
width: 100%;
background: linear-gradient(60deg, pink 50%, transparent 50%),
linear-gradient(-120deg, #000000 51%, transparent 50%);
display: flex;
align-items: center;
justify-content: center;
}
.gradient:hover .title {
transform: translateX(0)
}
</style>
</head>
<body>
<div class="gradient">
<h1 class="title">我是一个粉刷匠,粉刷本领强</h1>
</div>
</body>
</html>
文字颜色自适应背景颜色
最新推荐文章于 2024-09-06 22:20:29 发布