Answer the question
In order to leave comments, you need to log in
Why is svg not styled?
Hello!
I use object to display svg on the site
<object type="image/svg+xml" data="ссылка">
<img src="ссылка" alt="">
</object>
object svg{
fill: $accent;
width: 50%;
height: 50%;
}
Answer the question
In order to leave comments, you need to log in
You can style SVG elements that are displayed with the object tag
. To do this, add one line according to w3.org like this
<?xml-stylesheet href="svg.css" type="text/css"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 10" width="100px" height="80px">
<path d="......" />
</svg>
<object data="test.svg" type="image/svg+xml"></object>
svg path{
fill: lightblue;
stroke: blue;
stroke-width: 0.5px;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question