what I want to achieve is a div with a background-image that reflects the size of the div, I do not care who maintain the aspect ratio
Some test
<div style='position:absolute;width:"+obj.width+"px;height:"+obj.height+"px;margin-left:"+obj.left+"px;margin-top:"+obj.top+"px;background-image:url(img.png);background-size: 100%;background-repeat: no-repeat;border:1px solid red;'>;
<div style='position:absolute;width:"+obj.width+"px;height:"+obj.height+"px;margin-left:"+obj.left+"px;margin-top:"+obj.top+"px;background-image:url(img.png);background-size: cover;background-repeat: no-repeat;border:1px solid red;'>;
<div style='position:absolute;width:"+obj.width+"px;height:"+obj.height+"px;margin-left:"+obj.left+"px;margin-top:"+obj.top+"px;background-image:url(img.png);background-repeat: no-repeat;border:1px solid red;'>;