What is the difference between them.The image appears only in the first case.Why doesnt in appear in the second case?
<div id='" + this.panelId + "Icon-1" + "' style='width:34px;align:center;' class='iconDiv'><img id="+"Img"+ this.panelId+" src="+"Images/i24_grey-info.png"+" /></div>
<div id='" + this.panelId + "Icon-1" + "' style='width:34px;align:center; background-image:Images/i24_grey-info.png' class='iconDiv'></div>
Thanks to all . This works! But i get 4 images…i mean the image repeats 4 times 🙁 why is that?
this.iconDiv = "<div id='" + this.panelId + "Icon-1" + "' style='width:34px;height:34px; align:center;background-image: url(Images/i24x24_info.png);' class='iconDiv'></div>";
Your CSS is incorrect. There is no
alignstyle, usetext-align. Use a colon afterbackground-image, andurl()around the image URL:You might also have to set the height of the
divto the height of the image.