Scaling sprite image

If you’ve always wanted, just like me, a way to scale images used in CSS sprites: there’s a way [1]. It essentially comes down to a clever overlaying of a mask on an image:

1. a div with overflow:hidden and of a fixed size
2. an img pointing to the sprite is placed inside the div using scaling and absolute positioning so that only the desired portions shows through the div

[1] http://stackoverflow.com/questions/2430206/how-can-i-scale-an-image-in-a-css-sprite

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s