i need to put an image in background of a div at the center position of it, like:
What i've tried is:
<div id="container">
...
</div
<div id="background">
<img src="images/bg.png"/>
</div>
with this css:
div#container {
margin: 0 auto;
width: 52em;
}
div#bg img {
z-index: -999;
width: 100%;
height: 100%;
position: absolute;
top: 22%;
}
In my browser, with my screen size, i put 22% and all is ok, but if i try on another screen with different size background img isn't in the center of div. What can i do? can someonehelp me?