Hi @asasass maybe a bit of reading on the topic would help: https://css-tricks.com/css-sprites/
Mind you with the advent of HTTP2, sprites will be a thing of the past and I wouldn’t bother. They are very tedious and hard work to maintain and somewhat limiting!
In it’s simplest form the sprite image is styled as a background image on the anchor.
Then the background position of the sprite changes on hover, focus, active, mouseover.
Then there are some methods that allow for Replacement Text in the event that the user has images turned off or style sheets turned off.
Here is an example of the later using the vertical stacked sprite image you posted.
My take on sprites is that it does have to do with HTTP requests.
Back in the day, requests were limited in how many could be made concurrently. Some felt that it was better to request one single (heavier weight) file and use CSS to position it than it was to make multiple requests for individual (lighter weight) files. That is, the number of HTTP requests a page made was deemed a bottleneck that could result in slower page load times.
Since then things have changed and that particular bottleneck is no longer as much of a problem for small sprite eligible files.
However, IMHO, it is still a good idea to look into the number of HTTP requests a page makes and combine JavaScript and CSS files when it makes sense to.
Another term for “mouse-click” as you seem to be using it, is a:active {}. Look up the states that achors can have and the order in which they must be listed.
Hi @TechnoBear perhaps not directly but it is entitely related to the purpose of sprites… HTTP2 allows for the concurrent download of resources through a single TCP connection… Which defeats the reason of being for sprites altogether…
Yes, I understand the thinking behind sprites, and the arguments for and against them.
I was simply commenting that it’s my understanding the OP has no real interest in sprites per se; what he actually wants (for reasons unknown) is a method to preload an image.