I'm trying to give a div a background according to a spritesheet, meaning that it'll define the parts from the sprite sheet and use those accordingly in the div.

This is my sprite sheet image:

http://i.imgur.com/l6BpAOA.png


Now I would like to have a "dynamic" div that could get resized and would look similiar to this:

http://i.imgur.com/jtrN71T.png

If anybody could help or point me in the right direction that would be appreciated.