Reputation: 5129
I want to show part of a sprite image positioned at X and Y at the upper right corner of a div element. How should I do? For example, if I usebackground: url("the path") no-repeat 0 0
it will show the whole sprite image at the upper right corner of the div element. So actually I need to specify two coordinates, one is in sprite image, the other is in the div element.
Upvotes: 0
Views: 83
Reputation: 512
you have to wrap the sprite in another container and give that a specified height an width which is that of the section of the sprite you want to see, and then position the sprite in that.
like this: http://jsfiddle.net/Qa8Tp/
Upvotes: 1