我想创建与此页面相同的效果。当图像移动到它上面时,我做了除了透明文本之外的所有内容..
有人知道它是怎么做出来的吗?
非常感谢!
我所知道的一切我已经尝试过..
在这里你可以试试这个逻辑:
body{
background-color : black;
}
h1 {
background-clip: text;
color: transparent;
text-stroke: 1px white;
-webkit-text-stroke: 1px white;
}
h1:hover{
color : white;
}
<body>
<h1>HELLO WORLD</h1>
</body>
body{
background-color : black;
transition : 0.5s ease-in-out;
}
h1 {
background-clip: text;
color: transparent;
text-stroke: 1px white;
-webkit-text-stroke: 1px white;
}
/*change color to white of hovered element*/
div:hover h1{
color : white;
}
/*trick to select current and all sibling elements (~ selector)*/
div h1:hover, div h1:hover ~ h1 {
color : transparent;
}
<body>
<div>
<h1 class="a">ONE</h1>
<h1 class="b">TWO</h1>
<h1 class="a">THREE</h1>
<h1 class="a">FOUR</h1>
</div>
</body>