Tuesday 29 March 2016

Is it common to use sections of one image for multiple icons on your site?

While digging through reddit's source code today I noticed that most, if not all, of the icons on the front page were just sections taken from a much larger sprite sheet (http://ift.tt/1Th4uiK). Then by using CSS they use the background-position property to pick which portion of the sprite sheet to use. For example, this is their code for the styling of the upvote arrow:

.arrow.up { background-image: url(sprite-reddit.ZDiVRxCXXWg.png); background-position: -42px -865px; background-repeat: no-repeat; } 

Is this common for other sites to just have one image file but pull multiple images from it? I'm a noobie to web design so this may be common practice that I am not aware of.



Epic visual tool

Epson 5030UB 2D/3D 1080p 3LCD Projector Submitted March 29, 2016 at 09:00PM by MyLastNameIsMartini http://ift.tt/1MzojQC

No comments:

Post a Comment