I have the following design in which i have an image in between two <div>
's. my aim is to keep the image between the two divs.
in this example, I want the main image (400x200) to be in between the green image(#firstLayer
) and the gray(background for body). My solution works well in Firefox 16, safari, and Chrome, but doesnt work in IE. In IE the image gets displyed on top of the #firstLayer
.
here is a JFiddle of the problem
and here is the html and css for quick view:
HTML:
<body>
<div id="firstLayer">
<img id="image" class="center" src="http://lorempixel.com/400/200/" >
<div id="mainContent">
main page content
</div>
</div>
</body>
CSS:
body{
background:gray;
}
#firstLayer{
background: url("http://www.enough.de/fileadmin/docimport/images/background-image.png") no-repeat;
height:500px;
width:500px;
}
img#image{
z-index:-1;
}
.center{
width: 400px;
height: 200px;
position: absolute;
left: 50%;
top: 50%;
margin-left: -200px;
margin-top: -100px;
}
What is the Fix for this problem in IE?