As far as I can tell, it is not possible to place a CSS background image 1em from the right border of any block, neither is it possible to place a image 1em from the bottom.
The following code places the background image 1em from the left and 2em from the top.
<div class="foo" style="background: url('bar.png') no-repeat 1em 2em">
Some text here
</div>
Is there any way in CSS to specify that the background image should be "this far from the right edge" if the size of the box is dynamic and assuming that you cannot change the HTML?
(Percentages won't work, since the box can change size)
If this is not possible, what is the smallest amount of change you need to make to the HTML?
This is the workaround I came up with:
<style>
div.background
{
float: right;
background: url('bar.png') no-repeat top left;
margin-right: 1em;
width: 16px;
height: 16px;
}
</style>
<div class="foo">
<div class="background" style=""> </div>
Some text here
</div>