klmitchell2
klmitchell2

Reputation: 171

Changing SVG color via CSS, SVG color wont change

Heres my code:

HTML:

<img src="../img/icon-play.svg" class="play-button-svg">

SASS:

.play-button-svg
padding-left: 10px
fill: $white

The icon keep its original color and does not change to white.

Upvotes: 0

Views: 778

Answers (1)

BhagyashriK
BhagyashriK

Reputation: 525

by using SVG as image or background image you cant control with CSS. If you want '.play-button-svg' to work, you should place SVG code which will look like-

<svg ...>
  <path .../>
</svg>

Then apply class-

   <svg ...>
      <path class="play-button-svg" .../>
    </svg>

and now your CSS will work :)

Upvotes: 3

Related Questions