How to make SVG “fill” act in a similar way to CSS “background-size: cover”

前端 未结 2 1582
旧巷少年郎
旧巷少年郎 2021-01-17 11:56

I\'m am trying to create an SVG which masks an image with a particular path however, when I try to fill the area using a pattern, the image does not cover the entire area.

2条回答
  •  感动是毒
    2021-01-17 12:18

    To fix this, add an appropriate preserveAspectRatio attribute to the in your to tell it that you want the image to be zoomed and sliced.

    
      
    
    

    Demo here

提交回复
热议问题