SVG tag required for Firefox but appears to break CSS mask in Chrome

后端 未结 1 1331
花落未央
花落未央 2020-12-21 04:05

I\'m trying to mask content with an external SVG image like so:

#homepage-banner .desktop-slider.masked {
  -webkit-mask:url(news-panel-mask.svg) left top no         


        
相关标签:
1条回答
  • 2020-12-21 04:46

    As linked in my comment above, the solution is to use separate paths for each browser in the .svg file:

    <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1170px" height="494px" viewBox="0 0 1170 494" enable-background="new 0 0 1170 494" xml:space="preserve">
    
      <!-- Webkit -->
      <path fill="white" d="M1170.001,494V0h-352v141.605c0,2.2-0.521,5.274-2.075,6.832l-21.725,21.393c-1.554,1.557-3.2,4.631-3.2,6.832v131.692
    c0,2.2,2.021,5.274,3.575,6.832l20.975,21.393c1.554,1.557,2.45,4.631,2.45,6.831V494H1170.001z"/>
    
      <!-- Firefox -->
      <defs>
        <mask id="mask" maskUnits="userSpaceOnUse">
          <path fill="white" d="M1170.001,494V0h-352v141.605c0,2.2-0.521,5.274-2.075,6.832l-21.725,21.393c-1.554,1.557-3.2,4.631-3.2,6.832v131.692
    c0,2.2,2.021,5.274,3.575,6.832l20.975,21.393c1.554,1.557,2.45,4.631,2.45,6.831V494H1170.001z"/>
        </mask>
      </defs>
    
    </svg>
    
    0 讨论(0)
提交回复
热议问题