Grow your CSS skills. Land your dream job.

Last updated on:

Serve SVG with the Correct Content Type

If you are trying to use SVG like <img src="image.svg"> or as a CSS background-image, and the file is linked to correctly and everything seems right, but the browser isn't displaying it, it might be because your server is serving it with an incorrect content-type.

Add this to your .htaccess file at the root to fix it:

AddType image/svg+xml .svg .svgz

Leave a Comment

Current day month ye@r *

*May or may not contain any actual "CSS" or "Tricks".