1

I need to style svg image using CSS. My markup:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <style type="text/css">
    img .shape
    {
        fill: #ff0000;
    }
  </style>
</head>
<body>
  <img src="images/icon.svg" alt="" />
</body>
</html>

icon.svg:

<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <path class="shape" fill="#000" d="M17 17v3h-2v-3h-3v-2h3v-3h2v3h3v2h-3zM15 3H3v12h6v2H1V1h16v8h-2V3z" id="a"/>
</svg>

I tried some css selectors. None of them is working.

0

0

Browse other questions tagged or ask your own question.