I have a unique challenge where I need to display an image within a button. The image is dynamic and I want it to serve as the background so that I can change the image on hover and click events. The issue I am struggling with is that I need the button to adjust its size based on the dimensions of the background image, which I do not know in advance. For example:
<button id="rock" style='background-image: url(http://th07.deviantart.net/fs70/150/i/2013/012/c/6/rock_01_png___by_alzstock-d5r84up.png)'>Test Rock</button>
http://jsfiddle.net/5z1L67fw/1/
Another approach I am considering is adding an img child element inside the button. However, I wonder if it is feasible to change the image on hover and click in this setup.