With JavaScript, the element is assigned to var a
. If I simply assign its style background to an image (most images) as such: a.style = 'background:url(image.jpg)';
, the image's width and length will adjust perfectly to fit that of the div element's by default.
One particular issue though: I've snapped a quick pic with my phone (.jpg) and downloaded it on my pc and assigned its url value to the div element's background. It however does not adjust its width and height to that of the div element's.
Why is this? and how do I correct this issue?
Thanks in advance.