I am putting an image within a div which has a background image too. But only the image itself is appearing, the background image of the parent div is not appearing.
My code:
<div id="proceedbody" style="background: url(http://www.asifsinan.com/wp-content/uploads/2012/07/please-proceed-image.jpg); background-repeat: no-repeat; line-width:810px; line-height: 718px;"><img id="proceed" style="position: absolute; top:200; left:350;" src="http://www.asifsinan.com/wp-content/uploads/2012/07/please-proceed-matter.png"></div>
There are several problems with the code, but the one that prevents the background from showing is
position: absolute. That way, theimgelement is taken out of the normal flow of the document, leaving nothing inside thediv, so its height will be zero.However, if you set dimensions explicitly for the
div, then you can have theimgabsolutely positioned (though it would probably be better, more robust, to setposition: relativeon thediv, so thatimg“absolute positioning” will be relative to thediv). For dimensioning, use theheightandwidthproperties.The settings
top:200; left:350are ignored by conforming browsers. Usetop:200px; left:350pxinstead.