如何让文字背景透明,只显示文字轮廓? [关闭]

问题描述 投票:0回答:2

我想创建与此页面相同的效果。当图像移动到它上面时,我做了除了透明文本之外的所有内容..

有人知道它是怎么做出来的吗?

https://www.bazil.fr/

非常感谢!

我所知道的一切我已经尝试过..

css css-animations transparent
2个回答
0
投票

在这里你可以试试这个逻辑:

   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>


0
投票

   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>

© www.soinside.com 2019 - 2024. All rights reserved.