Cut-out text with CSS

前端 未结 3 2058
花落未央
花落未央 2020-12-07 02:34

I try to create a hover effect for a button in CSS.
\"How

Basically text sho

相关标签:
3条回答
  • 2020-12-07 03:10

    In my example below, I'm using CSS mix-blend-mode with a blend mode of difference.

    @import url(http://fonts.googleapis.com/css?family=Raleway:900,600,500,800,700);
    * {
      box-sizing: border-box;
    }
    body {
      font-family: 'Raleway', sans-serif;
      background-color: white;
    }
    div {
      position: relative;
    }
    img {
      width:100%;
    }
    h1 {
      color: #000;
      background-color: #9c9c9c;
      padding: .5em 1em;
      position: absolute;
      bottom: 0;
      width: 100%;
      font-size: 10vw;
      font-weight: 900;
      text-transform: uppercase;
      mix-blend-mode: difference;
    }
    <div>
      <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/9674/isolation-destination.jpg" alt="" />
      <h1>Let the sun shine!</h1>
    </div>

    View on CodePen
    View my blog post on compositing and blending

    0 讨论(0)
  • 2020-12-07 03:12

    to follow my comment and links within , using svg , you can get this kind of things : http://codepen.io/gc-nomade/pen/Dqcio/

    svg {
      position:absolute;
      background:repeating-linear-gradient(-45deg,
        transparent,
        transparent 5px,
        black 5px,
        black 10px
        );
      width:600px;
      height:300px;
      box-sizing:border-box;
      background-clip: content-box; 
      padding:60px 70px;
    }
    text {
      font-size:8em;
      fill:url(#textpattern);
      stroke: white;
      border:solid;
      }
    div {
      position:relative;
      width:600px;
      margin:auto;
    }
    

    and markup :

        <div>
      <svg>
        <defs>
          <pattern id="textpattern" patternUnits="userSpaceOnUse" width="600" height="300" >
            <image xlink:href="http://lorempixel.com/600/300/nature/9" width="600" height="300"  x="-70px" y="-60px"/>
          </pattern>
        </defs>
        <text  y="120px" x="140px">test </text>
      </svg>
      <img src="http://lorempixel.com/600/300/nature/9" />
    </div>
    

    With CSS , you can even add transparent borders and radius to make it look weirder http://codepen.io/gc-nomade/pen/wsfvg/

    0 讨论(0)
  • 2020-12-07 03:21

    Try using Photoshop to create text with just outline and no background color then save it in a .png format then place that text inside div and decorate this div with gradient. hope this helps in someway

    Check Following Image Created in Photoshop....... this is a PNG Image...

    0 讨论(0)
提交回复
热议问题