I\'ve come across an interesting problem in the following line of code:
I know this is an old question but I found this useful..
In the case that your Resources/bar.png
is a foreground image in the form of a sprite, it makes sense to use an img
tag rather than a div
. When you do this it can help to have a 1px transparent image file which you use for the src
attribute, then set the background image as you do here e.g.
Here you set x
and y
to be the pixel position on the sprite that you want the image to start at. This technique is also explained at: http://www.w3schools.com/css/css_image_sprites.asp
Of course the downside of this is that there is an extra request, but it you're always using the same transparent image for you sprites it's not a massive deal.