Search code examples
htmlgoogle-chromesvgadobe-brackets

.svg displays as a broken image in Chrome, Safari and Opera. Locally


Here's the code:

<img src="../img/triangle.svg" id="triangle" alt="Arrow Down">

What's strange is that I'm using Brackets and in its Live Preview (some version of Chrome, opens as a different application) the svg displays correctly. But when I open it in any other browser, including the normal Chrome it doesn't display and reverts to the alt attribute.


Solution

  • I suppose your path is wrong. Try something different like /img/triangle.svg (the leading slash means the path is relative to your website root).