I want to set this style for an SVG <path>:
background-color: red;
background-image: url('myImage.png');
This picture has transparent pixels and I need background color to fill it.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What you would do in SVG is to define a
<pattern>that contains a rect with the color you want and the image you want, and then use that as fill for the<path>.See this example from the SVG testsuite.
‘background-image’ and ‘background-color’ don’t apply to svg content unless it’s handled by the CSS box model (so basically just the root svg element).