Adam
Adam

Reputation: 4780

Make CSS background-position reference an image from right to left

I know the typical way to use a sprite with background-position is to reference the images in the sprite using the upper left hand corner and provide negative coordinates. I have a rounded rectangle that I am using for buttons and I want to provide the coordinate for the upper right hand corner of the rectangle and and have it repeat-x to the left of the right edge of the triangle. Any thoughts?

Upvotes: 0

Views: 982

Answers (1)

The Dude
The Dude

Reputation: 31

From what I think you are asking, it sounds like you want to use this rule:

background-position: 100% 0;

or

background: url(image.png) repeat-x 100% 0;

That should push the background image over so that is matches up with the right side of whatever element it is in.

Upvotes: 1

Related Questions