Fill SVG path elements with a background image
P粉021553460
P粉021553460 2024-01-28 21:59:27
0
1
369

Is it possible to set background-image for an SVG <path> element?

For example, if I set the element class="wall", the CSS style .wall {fill: red;} works, but .wall{background-image : url(wall.jpg)} is not available, nor is .wall {background-color: red;}.

P粉021553460
P粉021553460

reply all(1)
P粉998100648

You can do this by setting the background to a pattern:


  
    
  

Adjust the width and height according to your image and then reference it from the path like this:

Working example

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template