Reputation: 1513
.i image,
.i path,
.i {
fill: red;
stroke: red;
margin-top: 5px;
}
<svg class="i">
<image class="i" xlink:href="https://nextgenthemes.com/wp-content/bubble.svg" height="100%" width="100%"/>
</svg>
It does work if I use the <use>
element and reference a symbol from a svg definitions file.
Upvotes: 0
Views: 935
Reputation: 7031
The SVG <image>
element does not accept fill
as an attribute. So it would not accept the CSS fill
equivalent.
W3C SVG <image>
element: http://www.w3.org/TR/SVG11/struct.html#ImageElement
Attribute definitions for the SVG <image>
element :
If it works with the SVG <use>
element than use it!
Upvotes: 1
Reputation: 101820
What you want is not possible, for two different reasons.
SVGs loaded via HTML <img>
or background-image
, or via an SVG <image>
can be considered as being rendered to a static form whose contents are not styleable by the parent. Think of it as having been converted to a bitmap.
CSS rules do not apply across document boundaries. You cannot have rules in one document (the HTML) that style elements in another document (in this case the SVG bubble.svg
).
Upvotes: 1