Positive Vibes to your Inbox

An occasional newsletter to brighten your inbox, bringing you the best thoughts and links from the studio


Fixed: SVG as background image not displaying remotely

Had a really weird bug the other day where an .svg image was not displaying as a background image.

Locally, everything was fine (running a local server, using MAMP) but when I pushed to the server, the .svg would not show.

The file was on the server, not corrupted, with the correct SVG URL in the CSS – I couldn’t for the life of me see what the issue was.

I then noticed in developer tools that the content type for the SVG was coming up as text/XML.

Adding the following line to the .htaccess fixed the issue for me:

AddType image/svg+xml .svg .svgz