2

I'm on the fence about coding about 8 social media icons on a site as either img tags or anchors with CSS background images that use sprites.

I wish I could do a poll here, but I'm interested in hearing from you all what you think is best and why?

Cofey
  • 11,144
  • 16
  • 52
  • 74

2 Answers2

3

Here's a link that addresses when it is best to use img tags versus CSS background images that use sprites: When to use IMG vs. CSS background-image?

It specifically gives the instances when CSS with sprites are better, because CSS with sprites

  1. are faster loading and
  2. can be used when you only want to partially display the image.

The link I gave provides a much more complete answer (my two points were off the top of my head, I bookmarked the link above and often use it for reference).

Community
  • 1
  • 1
Ellie Kesselman
  • 899
  • 1
  • 17
  • 34
  • That link is great, nice find. – Loktar Feb 12 '11 at 05:14
  • Thank you! I usually just use IMG, so details about CSS and sprites fly right out of my head, and I refer back to that link whenever I have the need. Or one other, but it isn't in the Stackexchange family! – Ellie Kesselman Feb 16 '11 at 22:39
1

I think, in terms of my preference, I like to use sprites. Primarily because you can put all your icons in one image file, css-move the background image to the location(s) and then the user only has to download (cache) the one file. This means less requests on your server, less files to wait for AND you can preload just the one file. And updating is easier, IMO.

Hope this helps.

TNC
  • 5,388
  • 1
  • 26
  • 28