Fill property does not work for SVG

I get my SVGs from thenounproject.com, however I cannot change their color since fill does nothing.

I use Ruby on Rails, so I used <% = image_tag ('#') ,: class => "tomatoe"%>

and my css looks like this

.tomatoe{
    @include transition-property(all);  
    @include transition-duration(1s);
    fill: white;
    width: 100px;
    margin-top: 1em;
}

Fill never works, tried this on several SVGs, but no luck, and I don't know why.

+4
source share
1 answer

You cannot customize SVG with CSS by importing it through the img tag, you will need to embed the SVG code in your HTML to achieve this.

, img SVG, CSS.

+10

All Articles