Serve SVG as an Image on Apache with .htaccess
I've been a massive fan of SVG since my days creating charts and animations with the Dojo Toolkit. SVG has been around forever, it even has IE support now, and it's ultra-flexible. When creating this site's redesign, I used SVG within an IMG tag and it work great locally. When I pushed to the live server, however, the image displayed as broken and I saw the following notice in the console:
Resource interpreted as Image but transferred with MIME type text/xml: "https://davidwalsh.name/logo.svg".
That was certainly unexpected. Obviously there was a difference in my local server and my production server, so after a bit of research, I found that the following .htaccess update would resolve the issue:
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
Serving SVG as XML, what it essentially is, really isn't of use to me -- I want to use it in its visual glory. Keep this snippet handy in case you also run into this issue!
With CSS border-radius, I showed you how CSS can bridge the gap between design and development by adding rounded corners to elements. CSS gradients are another step in that direction. Now that CSS gradients are supported in Internet Explorer 8+, Firefox, Safari, and Chrome...
Chances are that any Web designers using our Ghostlab browser testing app, which allows seamless testing across all devices simultaneously, will have worked with responsive design in some shape or form. And as today's websites and devices become ever more varied, a plethora of responsive images...
The idea of image preloading has been around since the dawn of the internet. When we didn't have all the fancy stuff we use now, we were forced to use ugly mouseover images to show dynamism. I don't think you were declared an official...
Working with textarea widths can be painful if you want the textarea to span 100% width. Why painful? Because if the textarea's containing element has padding, your "width:100%"
textarea will likely stretch outside of the parent container -- a frustrating prospect to say the least. Luckily...
Nice, I always missed that one. But isn’t it better to user dots before the file endings? In the original documentation for AddType the example says so.
With which MIME type will it be transferred after adding this configuration?
image/svg+xml