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


Leave a Reply

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

You are commenting using your 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.