I am working in javascript. I am facing an issue i.e. I want to place an image on another image. MY Code is follows:
<div>
<img src="1.jpg" style="z-index:1;"/>
<img src="2.png" style="z-index:2; left:-100px;"/>
</div>
The problem is when i run the code it places image on the right bottom corner of the DIV but not on the image.
Any help would be appreciated.
Working DEMO
Use
position: absolutein CSS:Note: You don’t need to specify
z-indexif you want last image to appear on top. This is default browser behaviour.