title: How can I apply a mask from an inline SVG that will work in Chrome?
body: <p>I want to clip my element using an SVG shape which is defined in the same HTML file (an inline SVG).</p>
  
  <p>It works with <code>clip-path</code>:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>div {
    width: 200px;
    height: 200px;
    background-color: red;
    clip-path: url("#c");
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div&gt;
    &lt;svg&gt;
      &lt;defs&gt;
        &lt;clippath id="c"&gt;
          &lt;circle cx="100" cy="100" r="50" /&gt;
        &lt;/clippath&gt;
      &lt;/defs&gt;
    &lt;/svg&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>But when using a mask, although this works fine in Firefox, it applies no masking in Chrome:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>div {
    width: 200px;
    height: 200px;
    background-color: red;
    mask: url("#m");
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div&gt;
    &lt;svg&gt;
      &lt;defs&gt;
        &lt;mask id="m"&gt;
          &lt;circle cx="100" cy="100" r="50" fill="white" /&gt;
        &lt;/mask&gt;
      &lt;/defs&gt;
    &lt;/svg&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Searching around (<a href="https://stackoverflow.com/questions/20600608">example</a>), it seems as though Chrome does not expect the mask to refer to a definition, but instead to an entire image. Is there a way to refer to an entire image if it has been inlined, though? Or, is there anything else I could do to apply a mask from an inline element?</p>