This is a really cool trick, definitely something I'll be looking at using in the future since I've come across this specific use case.
Do you know if there are any compatability issues with different browsers?
In modern browsers SVG support is very good so there shouldn't be any issues. I've even tested in IE11 and it works fine. There are a few ways to approach it though, inline SVGs seem to offer the best support while externally references ones (e.g. as an img) may differ from browser to browser. This codepen samples a number of those options which is useful for testing.
Thanks for your reply, James. IE11 support sounds great, that's as far down as I'm willing to go. ;) I'll take a look at the codepen samples.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.