Can a image tag in html z-index behind a css background image?
Sure, a HTML element with a background-image
and a higher z-index
can overlay any other HTML element, in your case a simple <img />
tag. But the <img>
tag has not to be nested within the tag holding the background image.
This will work
<img src="../image.jpg" />
<div style="background: url(../image2.gif); z-index: 1">Content</div>
this not:
<div style="background: url(../image2.gif); z-index: 1">
<img src="../imag.jpg" />
</div>
It works if you set position to either relative or absolute. Be sure to set it as it may just be inherited.