JSFiddle - React, Tailwind, and code Playground

by hangyangws

HTML

<div class="wrap">
  <svg class="text-demo" viewBox="0 0 600 400" width="600" height="400">
    <defs>
      <mask id="textMask">
        <rect width="100%" height="100%" fill="#fff" />
        <text x="50" y="200" id="myText">My Text</text>
        <text x="125" y="293" id="mySubtext">SVG</text>
      </mask>
    </defs>
    <ellipse
      class="text-mask"
      cx="300" cy="200" rx="300" ry="150"
      fill="rgba(255, 255, 255, 0.8)"
    />
  </svg>
</div>

CSS

.wrap {
  background: url('http://www.abbeyjfitzgerald.com/wp-content/uploads/2016/07/forest-example-square.jpg')center center / cover no-repeat;
  display: inline-block;
}

.text-demo-wrapper {
  width: 100%;
  height: auto;
  margin: 0 auto;
}

#myText {
  font-size: 125px;
  font-style: bold;
  fill: #000;
}

#mySubtext {
  font-size: 80px;
  font-family: Arial;
  stroke: #0DBF99;
  stroke-width: 4px;
  fill: #000;
}

.text-mask {
  mask: url("#textMask");
}