Using CSS approach how to set an image to fill a path in SVG?
问题 I want to create a CSS class to fill a path with image that can be applied on any SVG path and fill that path with image. The image must be stretch to fit that path. To achieve this; I create a pattern with image tag and set the width and height as 100% . but the image takes 100% of the whole screen instead of objectBoundingBox of the container (in this case svg tag). Below is the sample code: .myClass { fill: url(#image); stroke: red; stroke-width: 5; } <svg id='pattern' xmlns="http://www.w3