CSS sprites are almost always the way to go when it comes to applying background images with CSS efficiently. One hurdle you may come across is when you want to apply an image that's a part of a sprite to an element with an unknown height and width. We can hurdle that hurdle with CSS pseudo elements.
It's CSS-Tricks fourth birthday. Yay! Time for the traditional mid-year mini state of the site.
In this tutorial we'll learn the basics of the canvas
element. How to draw to it, create loops which redraw it allowing animation, and in the end, wind up with a basic playable "Snake" game.