<div class="container">
  <h1>Inline SVG Mask on HTML Element: Works only in Firefox</h1>
</div>

<!-- SVG markup -->
<svg class="svg-mask">
 	<defs>
 		<mask id="mask1" maskUnits="objectBoundingBox" maskContentUnits="objectBoundingBox">
    <linearGradient id="grad" gradientUnits="objectBoundingBox" x2="0" y2="1">
      <stop stop-color="white" offset="0"/>
      <stop stop-color="black" stop-opacity="0" offset="1"/>
    </linearGradient>
    <circle cx="0.50" cy="0.50" r="0.50" id="circle" fill="url(#grad)"/>
  	</mask>
 	</defs>
</svg>

<h2 class="title">SVG Mask on HTML element</h2>

<img class="masked-element" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/123941/backdropcssmask.jpg" alt="Masked element">
html {
  box-sizing: border-box;
}

*,
*:before,
*:after {
  box-sizing: inherit;
}

body {
  font-family: sans-serif;
  font-weight: 400;
  margin: 0;
  padding: 0;
  background-color: black;
  color: white;
}

.container {
  max-width: 90%;
  margin: 0 auto;
  text-align: center;
}

.svg-mask {
  position: absolute;
  width: 0;
  height: 0;
}

.masked-element {
  position: relative;
  display: block;
  margin: 0 auto;
  width: 50%;
  height: 50%;
  mask: url(#mask1);
}

.title {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  text-transform: uppercase;
  text-align: center;
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.