Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to reuse a css background sprite for icons of different sizes?

How to reuse a css background sprite for icons of different sizes?

Problem

I merged a set of Icons into one .png file and use css background-position to show these icons on a page, because img tags make a lot more http requests.

However, I need to show every icon in 2 different sizes: 20x20, 60x60. How can I do this without creating 2 separate .png files (20x400 and 60x1200)?

I am aware of the background-size property to scale the background image, but it is introduced in css3 and IE doesn't support it before 9.0.

Is it possible without using background-size?

Problem courtesy of: NeoWang

Solution

The best way to do this is using "font icon technology" - you can read all about this in the web. Also it is helps when you need your markup retina compatible

Solution courtesy of: AlexPrinceton

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

How to reuse a css background sprite for icons of different sizes?

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×