Using CSS to both scale AND reposition an image WITHIN a div?

Posted by pbarney on Stack Overflow See other posts from Stack Overflow or by pbarney
Published on 2010-05-02T04:30:31Z Indexed on 2010/05/02 4:37 UTC
Read the original article Hit count: 248

Filed under:
|
|
|

We know how to use CSS to show only part of an image within a div (i.e., image sprites), but the image has to be a background image.

We know how to use CSS to scale an image, but the image has to be an IMG.

Does anyone know of a way to scale and image and show only part of it?

For example, I want to:

  1. show pixels (15,15) through (100,100), and
  2. scale it up by 200%.

The first I can do by making in a background image. The second I can do by making it a foreground image. But so far, I have not ascertained how to do both. Is it even possible using only CSS/HTML?

© Stack Overflow or respective owner

Related posts about css

Related posts about html