Css – How to set the background-position to an absolute distance, starting from right?


I want to set a background image for a div, in a way that it is in the upper RIGHT of the div, but with a fixed 10px distance from top and right.

Here is how I would do that if wanted it in the upper LEFT of the div:

background: url(images/img06.gif) no-repeat 10px 10px;

Is there anyway to achieve the same result, but showing the background on the upper RIGHT?

Best Solution

In all modern browsers and IE down even to version 9 you can use a four-value syntax, specified in CSS3:

background-position: right 10px top 10px;

Source: MDN